diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index c949660d51642..d9f63b4cb75b1 100644 --- a/ext/opcache/Optimizer/sccp.c +++ b/ext/opcache/Optimizer/sccp.c @@ -2006,7 +2006,7 @@ static void sccp_mark_feasible_successors( scdf_mark_edge_feasible(scdf, block_num, target); return; } - s = 0; + s = block->successors_count - 1; break; case ZEND_SWITCH_STRING: if (Z_TYPE_P(op1) == IS_STRING) { @@ -2024,7 +2024,7 @@ static void sccp_mark_feasible_successors( scdf_mark_edge_feasible(scdf, block_num, target); return; } - s = 0; + s = block->successors_count - 1; break; default: for (s = 0; s < block->successors_count; s++) { diff --git a/ext/opcache/tests/bug80900.phpt b/ext/opcache/tests/bug80900.phpt new file mode 100644 index 0000000000000..02a9c2bb47d41 --- /dev/null +++ b/ext/opcache/tests/bug80900.phpt @@ -0,0 +1,56 @@ +--TEST-- +Bug 80900: Switch constant with incorrect type +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +yes +yes