ID: 16838
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Feature/Change Request
Operating System: all
PHP Version: 4.2.0
New Comment:
It is definitely not extraneous, as today PHP, despite
its claim to be a hypertext preprocessor, is not
capable of handling standard conforming XHTML
documents. Of course you can echo the ?xml-tag but
that was not my point. That would be just another
workaround for situations where your single goal is to
produce XML compliant *output*. There is an increasing
demand to keep the input files in a format that can be
processed by XML tools - most users I know of use
XHTML exactly for this reason and not for the mere fun
of adding closing tags all over the document :-)
But that is not the only problem. With the advent of
Apache 2 it will become common practice to apply
multiple filters successively to a source document,
e.g. use XSLT to produce XHTML with PHP from XML
sources and the send it to the PHP parser. What will
be PHP's answer? Don't use XML? Or enable PHP usage
through pre- and postprocessing filters that first
remove and then add xml-tags again?
To be honest, I think my suggested solution is neither
elegant nor very clever, but it should do its job.
Definitely the best solution would be to abolish all
kinds of short tag and asp tag syntax and only allow
the '<?php' and '<script..' styles. As far as I know,
there have been various discussions on that topic in
the past, so I decided not to suggest this again.
Thanks,
Sascha
Previous Comments:
------------------------------------------------------------------------
[2002-04-25 20:56:41] [EMAIL PROTECTED]
This seems extraneous to me. You can simply echo the one <?xml tag
that is usually needed. No need to turn off short_tags. Just do:
<?echo '<?xml ...'?> at the top.
------------------------------------------------------------------------
[2002-04-25 20:07:28] [EMAIL PROTECTED]
Hello,
I would like to suggest a small change in PHP's
handling of open tags.
I think it would be diserable to allow the use of the
short tag syntax ('<? ..?>') for documents also
containing <?xml [..] ?> tags. The increasing usage of
XML and especially XHTML (for which the <?xml..?> tag
is of course mandatory) will lead to a growing number
of collisions between PHP's syntax and user's
requirements.
AFAIK the only way for mixing xml-documents with PHP
code is to disable the short_open_tags option in the
php.ini file or make equivalent settings in the
httpd.conf (if using the Apache SAPI).
In my opinion, this is more a workaround than a real
solution. Obviously, it is impossible to include 'old'
code or third-party code which uses short tags and
even more important: not every user has access to the
php.ini file or httpd.conf file to modify the settings
accordingly.
Therefore I would like to propose to change the PHP
language scanner (as found in zend_language_scanner.l)
in a way that the token '<?xml' is not treated as a
PHP opening tag but rather (correctly) recognized as
inline HTML.
It could probably be sufficient to create an additional
rule for the scanner's <INITIAL>-start condition that
would catch the string '<?xml' before it can be
treated as an PHP open tag, e.g.:
<INITIAL>"<?xml" {
zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
zendlval->value.str.len = yyleng;
zendlval->type = IS_STRING;
return T_INLINE_HTML;
}
I'm not sure whether this piece of code really works
or has unwanted side effects etc., but I guess it can put
forward my intention more clearly than more words :-)
Thanks for your attention,
Sascha Loetz
([EMAIL PROTECTED])
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16838&edit=1