Skip to content

Commit 3c42471

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents f7596d1 + a5d3620 commit 3c42471

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Zend/tests/halt_compiler5.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--TEST--
2+
Using __COMPILER_HALF_OFFSET__ with trailing {} (OSS-Fuzz #17895)
3+
--FILE--
4+
<?php
5+
__COMPILER_HALT_OFFSET__;
6+
{}
7+
--EXPECTF--
8+
Warning: Use of undefined constant __COMPILER_HALT_OFFSET__ - assumed '__COMPILER_HALT_OFFSET__' (this will throw an Error in a future version of PHP) in %s on line %d

Zend/zend_compile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7764,6 +7764,9 @@ void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */
77647764

77657765
while (last && last->kind == ZEND_AST_STMT_LIST) {
77667766
zend_ast_list *list = zend_ast_get_list(last);
7767+
if (list->children == 0) {
7768+
break;
7769+
}
77677770
last = list->child[list->children-1];
77687771
}
77697772
if (last && last->kind == ZEND_AST_HALT_COMPILER) {

0 commit comments

Comments
 (0)