|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-08-02 11:20 UTC] pajoye@php.net
-Status: Open
+Status: Bogus
[2011-08-02 11:20 UTC] pajoye@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Mar 18 23:00:01 2026 UTC |
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 />