|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-10-07 09:25 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 05:00:02 2025 UTC |
Description: ------------ If an xhtml file hava first line like this "<?xml version="1.0" encoding="UTF-8"?>" PHP will report an error: "parse error, unexpected T_STRING in bug.php on line 1" It seems to be PHP check (1)<? ... ?> or (2)<?php ... ?> and think it contain PHP code. If document contain something like this (3)"<?... ... ?>" PHP will report an error. Reproduce code: --------------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Bug Report</title> </head> <body> <?php echo 'Message ...'; ?> </body> </html> Expected result: ---------------- This will work well. PHP couldn't to parse anything unless it is "<?php ...?>". Actual result: -------------- PHP Parse error: parse error, unexpected T_STRING in bug.php on line 1