Fixed bug #77191
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 13 Aug 2019 09:19:58 +0000 (11:19 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 13 Aug 2019 09:19:58 +0000 (11:19 +0200)
NEWS
ext/opcache/Optimizer/dce.c
ext/opcache/tests/bug77191.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index f245fa8b16cc6a7d4b888abfe679a6743e9a4dc8..a8f1b6c77125cc605d88e93a2ec2f05c3c0a2ebd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,10 @@ PHP                                                                        NEWS
 - MySQLnd:
   . Fixed bug #78179 (MariaDB server version incorrectly detected). (cmb)
 
+- Opcache:
+  . Fixed bug #77191 (Assertion failure in dce_live_ranges() when silencing is
+    used). (Nikita)
+
 - Standard:
   . Fixed bug #69100 (Bus error from stream_copy_to_stream (file -> SSL stream)
     with invalid length). (Nikita)
index c146599a353a40adbcb51ae19c16fecb1f94bc46..16143af1ead7a1da4f83ecb151bdda2abc2de6e1 100644 (file)
@@ -565,7 +565,8 @@ static void dce_live_ranges(context *ctx, zend_op_array *op_array, zend_ssa *ssa
 
                        if ((op_array->opcodes[def].result_type == IS_UNUSED) &&
                                        (UNEXPECTED(op_array->opcodes[def].opcode == ZEND_EXT_STMT) ||
-                                       UNEXPECTED(op_array->opcodes[def].opcode == ZEND_EXT_FCALL_END))) {
+                                       UNEXPECTED(op_array->opcodes[def].opcode == ZEND_EXT_FCALL_END) ||
+                                       UNEXPECTED(op_array->opcodes[def].opcode == ZEND_END_SILENCE))) {
                                def--;
                        }
 
diff --git a/ext/opcache/tests/bug77191.phpt b/ext/opcache/tests/bug77191.phpt
new file mode 100644 (file)
index 0000000..ca04b4a
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Bug #77191: Assertion failure in dce_live_ranges() when silencing is used
+--FILE--
+<?php
+function test($x) {
+       switch (@$x['y']) {
+               case 1: return 'a';
+               case 2: return 'b';
+               case 3: return 'c';
+               case 4: return 'd';
+       }
+       return 'e';
+}
+var_dump(test([]));
+?>
+--EXPECT--
+string(1) "e"