mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix GH-13931: Applying zero offset to null pointer in Zend/zend_opcode.c
In the test cases, the compiler bails out due to a fatal error. The data structures used by the compiler will contain stale values. In particular, for the test case CG(loop_var_stack) will contain data. The next compilation will incorrectly use elements from the previous stack. To solve this, we reset part of the compiler data structures. We don't do a full re-initialization via init_compiler() because that will also reset streams and resources. Closes GH-13938.
This commit is contained in:
parent
5f9b9c4e23
commit
c3acfb1b57
4 changed files with 54 additions and 0 deletions
21
sapi/phpdbg/tests/gh13931.phpt
Normal file
21
sapi/phpdbg/tests/gh13931.phpt
Normal file
|
@ -0,0 +1,21 @@
|
|||
--TEST--
|
||||
Applying zero offset to null pointer in Zend/zend_opcode.c
|
||||
--FILE--
|
||||
<?php
|
||||
function foo () {
|
||||
try {
|
||||
break;
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
foo();
|
||||
?>
|
||||
--PHPDBG--
|
||||
ev 1 + 3
|
||||
ev 2 ** 3
|
||||
q
|
||||
--EXPECTF--
|
||||
Fatal error: 'break' not in the 'loop' or 'switch' context in %s on line %d
|
||||
prompt> 4
|
||||
prompt> 8
|
||||
prompt>
|
Loading…
Add table
Add a link
Reference in a new issue