Bart de Boer wrote:
> I feel I can't disagree with my hero. :) But is that really so?
> 
> The XML spec says:
> 
> PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
> 
> Doesn't Char* mean any char?
> 
> All the parsers seem to accept '>' inside PI's without problems too.

If you pick your standards carefully, sure.  ;)

I chose the PHP syntax before there was an XML spec.  Back in the dark
ages where HTML was defined as an SGML DTD.  In SGML-speak <? is a
general delimiter called PIO, < is STAGO and > is PIC.  In those early
HTML DTD's you couldn't have a PIO element that contained STAGO or PIC.
ISO-8879 has all the uglyness in it if you want to dig a bit, but even
with that it doesn't really tell the whole story of the conditions at
the time.

The point being that it was a conscious decision to not try to strictly
comply with the specification at the time or to write a PHP DTD, but
instead to focus on convenience first and the spec second.  You still
have plenty of things you can do today that doesn't match modern XML
specs.  For example:

  <?php echo '?>'; ?>

Or anything with ctrl chars in it.  You can put a literal 0x07 char in a
quoted string, for example, and PHP will happily pass that through, but
that is also not allowed in the spec.

-Rasmus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to