com php-src: Fixed bug #70293 (Crash with specific assertions and zend.assertions=-1): NEWS Zend/tests/bug702 93.phpt Zend/zend_compile.c
| From: | Bob Weinand | Date: | Tue, 18 Aug 2015 13:01:24 +0000 |
| Subject: | com php-src: Fixed bug #70293 (Crash with specific assertions and zend.assertions=-1): NEWS Zend/tests/bug702 93.phpt Zend/zend_compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88587@lists.php.net to get a copy of this message | ||
Commit: 34834c58fac070fe9fd8b0e595f6fad7993a3c68
Author: Bob Weinand <bobwei9@hotmail.com> Tue, 18 Aug 2015 15:01:24 +0200
Parents: 9a138b47c955c60f13062ff7bb60a4d0f5ec7532
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=34834c58fac070fe9fd8b0e595f6fad7993a3c68
Log:
Fixed bug #70293 (Crash with specific assertions and zend.assertions=-1)
Bugs:
https://bugs.php.net/70293
Changed paths:
M NEWS
A Zend/tests/bug70293.phpt
M Zend/zend_compile.c
Diff:
diff --git a/NEWS b/NEWS
index 677d5cc...5aeccc8 100644
--- a/NEWS
+++ b/NEWS
@@ -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)
diff --git a/Zend/tests/bug70293.phpt b/Zend/tests/bug70293.phpt
new file mode 100644
index 0000000..0722fb5
--- /dev/null
+++ b/Zend/tests/bug70293.phpt
@@ -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
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index c73ca98..b795f39 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -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);
+ }
}
}
}