Browse Source

Fixed bug #75252

pull/2768/head
Nikita Popov 9 years ago
parent
commit
73d6456d7d
  1. 2
      NEWS
  2. 28
      Zend/tests/bug75252.phpt
  3. 2
      Zend/zend.c
  4. 4
      main/main.c

2
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).

28
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)"

2
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;

4
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);

Loading…
Cancel
Save