Bug #16838: PHP short_open_tags and <?xml .. ?>

From: Date: Fri, 26 Apr 2002 00:07:29 +0000
Subject: Bug #16838: PHP short_open_tags and <?xml .. ?>
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-6029@lists.php.net to get a copy of this message
From: sloetz@web.de Operating system: all PHP version: 4.2.0 PHP Bug Type: Feature/Change Request Bug description: PHP short_open_tags and <?xml .. ?> 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 (sloetz@web.de) -- Edit bug report at http://bugs.php.net/?id=16838&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16838&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16838&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16838&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16838&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16838&r=support Expected behavior: http://bugs.php.net/fix.php?id=16838&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16838&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16838&r=submittedtwice

« previous php.bugs (#6029) next »