php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48124 php -l stops on XML declarations
Submitted: 2009-04-30 19:59 UTC Modified: 2009-04-30 20:08 UTC
From: colin at viebrock dot ca Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 5.2.9 OS: Linux
Private report: No CVE-ID: None
 [2009-04-30 19:59 UTC] colin at viebrock dot ca
Description:
------------
Using the CLI version, "php -l" will think an XML declaration like:

  <?xml version="1.0" encoding="UTF-8"?>

is PHP code and throw a syntax error

Reproduce code:
---------------
<?php
$a = 1;
?><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>test</title>
</head>
<body>
<p>Test</p>
</body>
</html>


Expected result:
----------------
php -l should not report any errors

Actual result:
--------------
cmv@web1:~$ php -l test.php 
PHP Parse error:  syntax error, unexpected T_STRING in test.php on line 
3
Errors parsing test.php
cmv@web1:~$ 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-30 20:08 UTC] jani@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Ever heard of "short_open_tag" ??
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 16 10:01:31 2024 UTC