|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44654 Syntax error for #
Submitted: 2008-04-06 14:19 UTC Modified: 2008-07-06 16:23 UTC
From: xuefer at gmail dot com Assigned: nlopess
Status: Closed Package: Compile Failure
PHP Version: 5.3CVS-2008-04-06 (CVS) OS: *
Private report: No CVE-ID:
 [2008-04-06 14:19 UTC] xuefer at gmail dot com
$ php -r 'if (1) { ?>#<?php }'

Parse error: syntax error, unexpected $end in Command line code on line 1

note that you cannot reproduce with ?> #<?php (with a space before #

Reproduce code:

<?php if (1) { ?>#<?php } ?>

#<?php echo 1; ?>
#<?php echo 1; ?>

#<?php echo 1; ?>
#<?php echo 1; ?>

Expected result:
used to work in php5.2 IIRC and echo # character

Actual result:
Parse error: syntax error, unexpected $end in Command line code on line 1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-07 08:05 UTC]
Are you running PHP in CGI mode? If so then it might be the CGI shebang doing funky stuff after my guessings atleast in 2.php even though it isn't #! as shebangs normally are...

For the CLI example I think (from memories) that you can't break in and out of php with the -r option.
 [2008-04-07 17:04 UTC] xuefer at gmail dot com
tested with cli and fastcgi web (not cgi), so not a shebang problem.
we're talking about this bug at mailinglist and looks like it's relatived to re2c lexer changes recentl
 [2008-04-07 17:51 UTC]
It is.

Was added during the conversion to handle the shebang, it may not be quite working as expected though.
 [2008-07-06 16:23 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Oct 13 07:01:43 2015 UTC