From: Operating system: Windows 7 64-bits PHP version: 5.3SVN-2011-08-02 (SVN) Package: Scripting Engine problem Bug Type: Bug Bug description:comment / php endtag
Description: ------------ When my source contains this code: <?php // $DOMDoc = new DOMDocument(); // $DOMDoc->loadXML("<?xml version=\"1.0\" encoding=\"utf-8\"?><annotations><annotation><type>Goal</type><datetime>12-07-2011 14:05:03</datetime></annotation><annotation><type>Corner</type><datetime>12-07-2011 14:09:33</datetime></annotation></annotations>"); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?> <request>"; ?> it will generate a parse error unexpected T_STRING at the echo command... If I remove the comment the error is resolved. The cause of this lies in the php endtag ?> witch is found in the comment (in this case this is not even the php endtag but an xml endtag...) Putting a space in between ? > is enough to make it work again, but I still think of this behaviour as a bug. Test script: --------------- not working: <?php // $DOMDoc = new DOMDocument(); // $DOMDoc->loadXML("<?xml version=\"1.0\" encoding=\"utf-8\"?><annotations><annotation><type>Goal</type><datetime>12-07-2011 14:05:03</datetime></annotation><annotation><type>Corner</type><datetime>12-07-2011 14:09:33</datetime></annotation></annotations>"); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?> <request>"; ?> working (space between ? and >): <?php // $DOMDoc = new DOMDocument(); // $DOMDoc->loadXML("<?xml version=\"1.0\" encoding=\"utf-8\"? ><annotations><annotation><type>Goal</type><datetime>12-07-2011 14:05:03</datetime></annotation><annotation><type>Corner</type><datetime>12-07-2011 14:09:33</datetime></annotation></annotations>"); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?> <request>"; ?> Expected result: ---------------- <?xml version=\"1.0\" encoding=\"utf-8\"?> <request> Actual result: -------------- <br /> <b>Parse error</b>: syntax error, unexpected T_STRING in <b>/usr/big_disk/www/Rogier/voetbal_applicatie/php/main.php</b> on line <b>5</b><br /> -- Edit bug report at https://bugs.php.net/bug.php?id=55345&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55345&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55345&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55345&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55345&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55345&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55345&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55345&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55345&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55345&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55345&r=support Expected behavior: https://bugs.php.net/fix.php?id=55345&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55345&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55345&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55345&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55345&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55345&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55345&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55345&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55345&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55345&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55345&r=mysqlcfg