Bug #75252 [NEW]: Incorrect token formatting on two parse errors in one request

From: Date: Sun, 24 Sep 2017 06:46:20 +0000
Subject: Bug #75252 [NEW]: Incorrect token formatting on two parse errors in one request
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211337@lists.php.net to get a copy of this message
From: nikic Operating system: PHP version: 7.0.23 Package: Scripting Engine problem Bug Type: Bug Bug description:Incorrect token formatting on two parse errors in one request Description: ------------ If two ParseErrors are thrown in the same request (e.g. by using eval or the ast extension), the replacement of the token name with the token value is only performed for the first error. This happens because the CG(parse_error) global does not get reset if the ParseError exception is caught. Test script: --------------- <?php $code = <<<'CODE' function test_missing_semicolon() : string { $x = [] FOO } CODE; try { eval($code); } catch (ParseError $e) { var_dump($e->getMessage()); } try { eval($code); } catch (ParseError $e) { var_dump($e->getMessage()); } Expected result: ---------------- string(41) "syntax error, unexpected 'FOO' (T_STRING)" string(41) "syntax error, unexpected 'FOO' (T_STRING)" Actual result: -------------- string(41) "syntax error, unexpected 'FOO' (T_STRING)" string(46) "syntax error, unexpected identifier (T_STRING)" -- Edit bug report at https://bugs.php.net/bug.php?id=75252&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75252&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75252&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75252&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75252&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75252&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75252&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75252&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75252&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75252&r=support Expected behavior: https://bugs.php.net/fix.php?id=75252&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75252&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75252&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75252&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75252&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75252&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75252&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75252&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75252&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75252&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75252&r=mysqlcfg

« previous php.bugs (#211337) next »