Re: Amaya corrupts HTML containing PHP code

On Wednesday 13 June 2007 19:09, Keith Rubow wrote:
> I have found that Amaya corrupts HTML documents containing embedded PHP
> code. For example, if I have a document containing the following:
>
> <p>this is a <a
> href="#L128<?php more here ?>" <?php still more here ?>>LINK</a> to
> the target.</p>
>
> If I open the document with Amaya, and then save it (without making any
> changes to the paragraph above), I find Amaya will change the code to
> the following:
>
> <p>this is a <a
> href="#L128&lt;?php more here ?&gt;"><?php still more here ?>&gt;LINK</a>
> to the target.</p>

It seems that PHP developers don't know well XML and HTML syntaxes.
Processing instructions are not allowed within an attribute value and within a 
tag. 

> Note that one "<" has been changed to "&lt;", and several ">" have been
> changed to "&gt;". This only seems to happen when the PHP tags (<?php
> some php code goes here ?>) are embedded inside HTML tags. However,
> unlike other tags (including HTML comments), it is perfectly acceptable
> for PHP tags to be included ABSOLUTELY ANYWHERE in the HTML document.
> They can be inside other HTML tags, and even inside quoted strings.

Comments are not allowed too at these positions.

> I can usually repair the corrupted file by replacing all "&lt;" with
> "<", and all "&gt;" with ">", but I cannot simply do a global search and
> replace. It is possible that my document could have contained "&lt;" and
> "&gt;" to represent the "<" and ">" characters in the text. So I must
> carefully evaluate each replacement to make sure I don't break something
> else.
>
> Is it possible to change Amaya so that it completely ignores any PHP
> tags, and preserves them unchanged when the document is saved? Of course
> some PHP tags would have to be destroyed when certain editing operations
> are performed, such as changing an attribute that contained embedded PHP.

This kind of change is an important development.

> Keith Rubow

     Irène.
-----
Irène Vatton                     INRIA Rhône-Alpes
INRIA                               ZIRST
e-mail: Irene.Vatton@inria.fr       655 avenue de l'Europe
Tel.: +33 4 76 61 53 61             Montbonnot
Fax:  +33 4 76 61 52 07             38334 Saint Ismier Cedex - France

Received on Wednesday, 20 June 2007 10:30:42 UTC