mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
If there's a try-finally where the try_op starts on a basic block with a single JMP, and the JMP optimization causes that basic block to become unreachable, then we update try_op. In this case, there is no catch_op, so try_op is erroneously set to 0, we should instead set it to `b->start`. Closes GH-18110.
46 lines
950 B
PHP
46 lines
950 B
PHP
--TEST--
|
|
GH-18107 (Opcache CFG jmp optimization with try-finally breaks the exception table)
|
|
--CREDITS--
|
|
SpencerMalone
|
|
--EXTENSIONS--
|
|
opcache
|
|
--INI--
|
|
opcache.optimization_level=0x10
|
|
opcache.opt_debug_level=0x20000
|
|
--FILE--
|
|
<?php
|
|
|
|
if (!isset($badvar)) {
|
|
throw new Exception("Should happen");
|
|
}
|
|
try {
|
|
while (true) { }
|
|
} finally {
|
|
throw new Exception("Should not happen");
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
$_main:
|
|
; (lines=%d, args=0, vars=%d, tmps=%d)
|
|
; (after optimizer)
|
|
; %s
|
|
0000 T1 = ISSET_ISEMPTY_CV (isset) CV0($badvar)
|
|
0001 JMPNZ T1 0006
|
|
0002 V3 = NEW 1 string("Exception")
|
|
0003 SEND_VAL_EX string("Should happen") 1
|
|
0004 DO_FCALL
|
|
0005 THROW V3
|
|
0006 JMP 0006
|
|
0007 V6 = NEW 1 string("Exception")
|
|
0008 SEND_VAL_EX string("Should not happen") 1
|
|
0009 DO_FCALL
|
|
0010 THROW V6
|
|
0011 FAST_RET T5
|
|
EXCEPTION TABLE:
|
|
0006, -, 0007, 0011
|
|
Fatal error: Uncaught Exception: Should happen in %s:%d
|
|
Stack trace:
|
|
#0 {main}
|
|
thrown in %s on line %d
|