php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42727 Zend doesn't fail with syntax error
Submitted: 2007-09-21 12:35 UTC Modified: 2012-06-05 23:07 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: php at hristov dot com Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: * OS: *
Private report: No CVE-ID: None
 [2007-09-21 12:35 UTC] php at hristov dot com
Description:
------------
See the example and the result. There is a stray quote. There is a warning, but it should be a parse error, shouldn't it?


Reproduce code:
---------------
<?php
'
echo "Should we see this?\n";
?>

Expected result:
----------------
Syntax error on line 2

Actual result:
--------------
andrey@whirlpool:~/dev/php6> ./php b.php
PHP Warning:  Unexpected character in input:  ''' (ASCII=39) state=1 in /home/andrey/dev/php6/b.php on line 2
Should we see this?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-02 11:47 UTC] tony2001@php.net
Doesn't look like a bug to me.
The lexer encounters unexpected character, reports about it (E_COMPILE_WARNING) and throws it away, continuing execution.
Surely it's possible to change this E_COMPILE_WARNING to E_COMPILE_ERROR, but I see no reasons to do it atm.
 [2011-04-08 21:13 UTC] jani@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem -Operating System: Linux +Operating System: * -PHP Version: 6CVS-2007-09-21 (CVS) +PHP Version: *
 [2012-06-05 23:07 UTC] nikic@php.net
Closing as this was already fixed. The sample code now throws

Parse error: syntax error, unexpected '' ' (T_ENCAPSED_AND_WHITESPACE) in /code/2qWahH on line 2

See http://codepad.viper-7.com/2qWahH.
 [2012-06-05 23:07 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jan 22 16:01:24 2020 UTC