Fixed bug #70293 (Crash with specific assertions and zend.assertions=-1)

This commit is contained in:
Bob Weinand 2015-08-18 15:01:24 +02:00
parent 9a138b47c9
commit 34834c58fa
3 changed files with 23 additions and 5 deletions

2
NEWS
View File

@ -17,7 +17,7 @@ PHP NEWS
. Fixed bug #69487 (SAPI may truncate POST data). (cmb)
. Fixed bug #70198 (Checking liveness does not work as expected).
(Shafreeck Sea, Anatol Belski)
. Fixed bug #70241 (Skipped assertions affect Generator returns). (Bob)
. Fixed bug #70241/#70293 (Skipped assertions affect Generator returns). (Bob)
. Fixed bug #70239 (Creating a huge array doesn't result in exhausted,
but segfault). (Laruence, Anatol)
. Fixed bug causing exception traces with anon classes to be truncated. (Bob)

16
Zend/tests/bug70293.phpt Normal file
View File

@ -0,0 +1,16 @@
--TEST--
Crash with specific assertions and zend.assertions=-1
--INI--
zend.assertions=-1
--FILE--
<?php
function f() {
assert(@$a ?: 1);
echo "OK";
};
f();
?>
--EXPECT--
OK

View File

@ -3074,10 +3074,12 @@ static void zend_compile_assert_side_effects(zend_ast *ast) /* {{{ */
for (i = 0; i < children; i++) {
zend_ast *child = (zend_ast_is_list(ast) ? zend_ast_get_list(ast)->child : ast->child)[i];
if (child->kind == ZEND_AST_YIELD) {
zend_mark_function_as_generator();
} else if (ast->kind >= ZEND_AST_IS_LIST_SHIFT) {
zend_compile_assert_side_effects(child);
if (child) {
if (child->kind == ZEND_AST_YIELD) {
zend_mark_function_as_generator();
} else if (ast->kind >= ZEND_AST_IS_LIST_SHIFT) {
zend_compile_assert_side_effects(child);
}
}
}
}