mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
Fix handling of sccp exceptions
We should clear the exception *before* we destroy the execute_data. Add a variation of the test that indirects through another file, and would crash otherwise.
This commit is contained in:
parent
a87d620543
commit
a505fc627e
3 changed files with 20 additions and 4 deletions
|
@ -1046,16 +1046,17 @@ static inline int ct_eval_func_call(
|
||||||
for (i = 0; i < num_args; i++) {
|
for (i = 0; i < num_args; i++) {
|
||||||
zval_ptr_dtor_nogc(EX_VAR_NUM(i));
|
zval_ptr_dtor_nogc(EX_VAR_NUM(i));
|
||||||
}
|
}
|
||||||
efree(execute_data);
|
|
||||||
EG(current_execute_data) = prev_execute_data;
|
|
||||||
|
|
||||||
|
int retval = SUCCESS;
|
||||||
if (EG(exception)) {
|
if (EG(exception)) {
|
||||||
zval_ptr_dtor(result);
|
zval_ptr_dtor(result);
|
||||||
zend_clear_exception();
|
zend_clear_exception();
|
||||||
return FAILURE;
|
retval = FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
efree(execute_data);
|
||||||
|
EG(current_execute_data) = prev_execute_data;
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SET_RESULT(op, zv) do { \
|
#define SET_RESULT(op, zv) do { \
|
||||||
|
|
2
ext/opcache/tests/opt/sccp_exception2.inc
Normal file
2
ext/opcache/tests/opt/sccp_exception2.inc
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?php
|
||||||
|
var_dump(version_compare('1.2', '2.1', '??'));
|
13
ext/opcache/tests/opt/sccp_exception2.phpt
Normal file
13
ext/opcache/tests/opt/sccp_exception2.phpt
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
--TEST--
|
||||||
|
Exception thrown during SCCP evaluation, separate file variation
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
require __DIR__ . '/sccp_exception2.inc';
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Fatal error: Uncaught ValueError: version_compare(): Argument #3 ($operator) must be a valid comparison operator in %s:%d
|
||||||
|
Stack trace:
|
||||||
|
#0 %s(%d): version_compare('1.2', '2.1', '??')
|
||||||
|
#1 %s(%d): require('/home/nikic/php...')
|
||||||
|
#2 {main}
|
||||||
|
thrown in %s on line %d
|
Loading…
Add table
Add a link
Reference in a new issue