Skip to content

Commit 171d6c3

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
2 parents d6a77c9 + 3c42471 commit 171d6c3

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
@@ -7951,6 +7951,9 @@ void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */
79517951

79527952
while (last && last->kind == ZEND_AST_STMT_LIST) {
79537953
zend_ast_list *list = zend_ast_get_list(last);
7954+
if (list->children == 0) {
7955+
break;
7956+
}
79547957
last = list->child[list->children-1];
79557958
}
79567959
if (last && last->kind == ZEND_AST_HALT_COMPILER) {

0 commit comments

Comments
 (0)