Skip to content

Commit d882795

Browse files
committed
Merge branch 'PHP-7.4'
2 parents 9fc5471 + 171d6c3 commit d882795

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Zend/tests/halt_compiler5.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Using __COMPILER_HALF_OFFSET__ with trailing {} (OSS-Fuzz #17895)
3+
--FILE--
4+
<?php
5+
__COMPILER_HALT_OFFSET__;
6+
{}
7+
--EXPECTF--
8+
Fatal error: Uncaught Error: Undefined constant '__COMPILER_HALT_OFFSET__' in %s:%d
9+
Stack trace:
10+
#0 {main}
11+
thrown in %s on line %d

Zend/zend_compile.c

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

78267826
while (last && last->kind == ZEND_AST_STMT_LIST) {
78277827
zend_ast_list *list = zend_ast_get_list(last);
7828+
if (list->children == 0) {
7829+
break;
7830+
}
78287831
last = list->child[list->children-1];
78297832
}
78307833
if (last && last->kind == ZEND_AST_HALT_COMPILER) {

0 commit comments

Comments
 (0)