Skip to content

Commit eaf6303

Browse files
committed
Fixed bug #79790
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.
1 parent e0743d0 commit eaf6303

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.0.0alpha3
44

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

69
09 Jul 2020, PHP 8.0.0alpha2
710

Zend/tests/bug79790.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Bug #79790: "Illegal offset type" exception during AST evaluation not handled properly
3+
--FILE--
4+
<?php
5+
b();
6+
function b($a = array()[array ()]) {
7+
++$c[function () {}];
8+
}
9+
?>
10+
--EXPECTF--
11+
Fatal error: Uncaught TypeError: Illegal offset type in %s:%d
12+
Stack trace:
13+
#0 %s(%d): b()
14+
#1 {main}
15+
thrown in %s on line %d

Zend/zend_ast.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,9 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c
750750

751751
zval_ptr_dtor_nogc(&op1);
752752
zval_ptr_dtor_nogc(&op2);
753+
if (UNEXPECTED(EG(exception))) {
754+
return FAILURE;
755+
}
753756
}
754757
break;
755758
default:

0 commit comments

Comments
 (0)