diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | Zend/tests/bug80194.phpt | 22 | ||||
-rw-r--r-- | ext/opcache/Optimizer/block_pass.c | 2 |
3 files changed, 25 insertions, 1 deletions
@@ -29,6 +29,8 @@ PHP NEWS - OPcache: . Fixed bug #80083 (Optimizer pass 6 removes variables used for ibm_db2 data binding). (Nikita) + . Fixed bug #80194 (Assertion failure during block assembly of unreachable + free with leading nop). (Nikita) - PCRE: . Updated to PCRE 10.35. (cmb) diff --git a/Zend/tests/bug80194.phpt b/Zend/tests/bug80194.phpt new file mode 100644 index 0000000000..9a5cdcd718 --- /dev/null +++ b/Zend/tests/bug80194.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #80194: Assertion failure during block assembly of unreachable free with leading nop +--FILE-- +<?php + +function test($x) { + switch ($x->y) { + default: + throw new Exception; + case 'foobar': + return new stdClass(); + break; + } +} + +$x = (object)['y' => 'foobar']; +var_dump(test($x)); + +?> +--EXPECT-- +object(stdClass)#2 (0) { +} diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 17b89c4d53..22d4b5294e 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -1941,7 +1941,7 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx) /* Eliminate NOPs */ for (b = blocks; b < end; b++) { - if (b->flags & ZEND_BB_REACHABLE) { + if (b->flags & (ZEND_BB_REACHABLE|ZEND_BB_UNREACHABLE_FREE)) { strip_nops(op_array, b); } } |