php.net |  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 (profile)
Status: Closed Package: Compile Failure
PHP Version: 5.3CVS-2008-04-06 (CVS) OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: xuefer at gmail dot com
New email:
PHP Version: OS:

 

 [2008-04-06 14:19 UTC] xuefer at gmail dot com
Description:
------------
$ 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:
---------------
1.php

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

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

expected:
#1#1
actual:
#<?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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-07 08:05 UTC] kalle@php.net
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] scottmac@php.net
It is.

http://lxr.php.net/source/ZendEngine2/zend_language_scanner.l#2155

Was added during the conversion to handle the shebang, it may not be quite working as expected though.
 [2008-07-06 16:23 UTC] nlopess@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 19:01:29 2024 UTC