com php-src: Fixed bug #75252: NEWS Zend/tests/bug75252.phpt Zend/zend.c main/main.c

From: Date: Sun, 24 Sep 2017 06:53:27 +0000
Subject: com php-src: Fixed bug #75252: NEWS Zend/tests/bug75252.phpt Zend/zend.c main/main.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-99518@lists.php.net to get a copy of this message
Commit: 73d6456d7d6be62340b3607805a45cbf420c1cb8 Author: Nikita Popov <nikita.ppv@gmail.com> Sun, 24 Sep 2017 08:53:27 +0200 Parents: da2f58183377571fc7f10e5bdae1786f46fb9639 Branches: PHP-7.0 PHP-7.1 PHP-7.2 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=73d6456d7d6be62340b3607805a45cbf420c1cb8 Log: Fixed bug #75252 Bugs: https://bugs.php.net/75252 Changed paths: M NEWS A Zend/tests/bug75252.phpt M Zend/zend.c M main/main.c Diff: diff --git a/NEWS b/NEWS index f937e78..f1cc520 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ PHP NEWS - Core: . Fixed bug #75236 (infinite loop when printing an error-message). (Andrea) + . Fixed bug #75252 (Incorrect token formatting on two parse errors in one + request). (Nikita) - SPL: . Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags). diff --git a/Zend/tests/bug75252.phpt b/Zend/tests/bug75252.phpt new file mode 100644 index 0000000..16679e4 --- /dev/null +++ b/Zend/tests/bug75252.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #75252: Incorrect token formatting on two parse errors in one request +--FILE-- +<?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()); +} + +?> +--EXPECT-- +string(41) "syntax error, unexpected 'FOO' (T_STRING)" +string(41) "syntax error, unexpected 'FOO' (T_STRING)" diff --git a/Zend/zend.c b/Zend/zend.c index 110673e..bca1dbd 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -896,6 +896,8 @@ void zend_set_utility_values(zend_utility_values *utility_values) /* {{{ */ /* this should be compatible with the standard zenderror */ ZEND_COLD void zenderror(const char *error) /* {{{ */ { + CG(parse_error) = 0; + if (EG(exception)) { /* An exception was thrown in the lexer, don't throw another in the parser. */ return; diff --git a/main/main.c b/main/main.c index 48c1a63..ce33cfb 100644 --- a/main/main.c +++ b/main/main.c @@ -1200,9 +1200,7 @@ static ZEND_COLD void php_error_cb(int type, const char *error_filename, const u sapi_header_op(SAPI_HEADER_REPLACE, &ctr); } /* the parser would return 1 (failure), we can bail out nicely */ - if (type == E_PARSE) { - CG(parse_error) = 0; - } else { + if (type != E_PARSE) { /* restore memory limit */ zend_set_memory_limit(PG(memory_limit)); efree(buffer);

« previous php.cvs (#99518) next »