]> granicus.if.org Git - php/commitdiff
Fixed wrong assertion
authorDmitry Stogov <dmitry@zend.com>
Mon, 10 Sep 2018 12:26:38 +0000 (15:26 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 10 Sep 2018 12:26:38 +0000 (15:26 +0300)
ext/opcache/Optimizer/dfa_pass.c
ext/opcache/tests/ssa_bug_011.phpt [new file with mode: 0644]

index 07cff986df21dd42cf0987b65e9a1087eaad3cbe..7e52226af5596eb508a3bb2b17cd5ede13cef93d 100644 (file)
@@ -704,8 +704,7 @@ optimize_jmpnz:
                                                        take_successor_1(ssa, block_num, block);
                                                        goto optimize_nop;
                                                }
-                                       } else {
-                                               ZEND_ASSERT(block->successors_count == 2);
+                                       } else if (block->successors_count == 2) {
                                                if (block->successors[0] == next_block_num) {
                                                        take_successor_0(ssa, block_num, block);
                                                        if (opline->op1_type == IS_CV && (OP1_INFO() & MAY_BE_UNDEF)) {
@@ -737,8 +736,7 @@ optimize_jmpnz:
                                                opline->extended_value = 0;
                                                opline->opcode = ZEND_JMP;
                                                goto optimize_jmp;
-                                       } else {
-                                               ZEND_ASSERT(block->successors_count == 2);
+                                       } else if (block->successors_count == 2) {
                                                if (block->successors[0] == block->successors[1]) {
                                                        take_successor_0(ssa, block_num, block);
                                                        if (block->successors[0] == next_block_num) {
diff --git a/ext/opcache/tests/ssa_bug_011.phpt b/ext/opcache/tests/ssa_bug_011.phpt
new file mode 100644 (file)
index 0000000..3c12777
--- /dev/null
@@ -0,0 +1,15 @@
+--TEST--
+Wrong assertion
+--FILE--
+<?php
+function foo($transitions) {
+       foreach ($transitions as $transition) {
+               if (isEmpty()) {
+                       continue;
+               }
+       }
+}
+?>
+OK
+--EXPECT--
+OK