Skip to content

Commit

Permalink
Fixed bug #79790
Browse files Browse the repository at this point in the history
I haven't tracked down in detail where the interaction with
increment_function comes from, but the root problem here is failure
to handle the illegal offset type exception.
  • Loading branch information
nikic committed Jul 7, 2020
1 parent e0743d0 commit eaf6303
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.0.0alpha3

- Core:
. Fixed bug #79790 ("Illegal offset type" exception during AST evaluation
not handled properly). (Nikita)

09 Jul 2020, PHP 8.0.0alpha2

Expand Down
15 changes: 15 additions & 0 deletions Zend/tests/bug79790.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--TEST--
Bug #79790: "Illegal offset type" exception during AST evaluation not handled properly
--FILE--
<?php
b();
function b($a = array()[array ()]) {
++$c[function () {}];
}
?>
--EXPECTF--
Fatal error: Uncaught TypeError: Illegal offset type in %s:%d
Stack trace:
#0 %s(%d): b()
#1 {main}
thrown in %s on line %d
3 changes: 3 additions & 0 deletions Zend/zend_ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,9 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c

zval_ptr_dtor_nogc(&op1);
zval_ptr_dtor_nogc(&op2);
if (UNEXPECTED(EG(exception))) {
return FAILURE;
}
}
break;
default:
Expand Down

0 comments on commit eaf6303

Please sign in to comment.