mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Handle throwing destructor in BIND_STATIC
This commit is contained in:
commit
9346da8964
3 changed files with 22 additions and 4 deletions
18
Zend/tests/bind_static_exception.phpt
Normal file
18
Zend/tests/bind_static_exception.phpt
Normal file
|
@ -0,0 +1,18 @@
|
|||
--TEST--
|
||||
BIND_STATIC may destroy a variable with a throwing destructor
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
function __destruct() {
|
||||
throw new Exception("Foo");
|
||||
}
|
||||
}
|
||||
try {
|
||||
$new = new Test;
|
||||
static $new;
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
Foo
|
|
@ -8708,9 +8708,9 @@ ZEND_VM_HANDLER(183, ZEND_BIND_STATIC, CV, UNUSED, REF)
|
|||
|
||||
value = (zval*)((char*)ht->arData + (opline->extended_value & ~(ZEND_BIND_REF|ZEND_BIND_IMPLICIT|ZEND_BIND_EXPLICIT)));
|
||||
|
||||
SAVE_OPLINE();
|
||||
if (opline->extended_value & ZEND_BIND_REF) {
|
||||
if (Z_TYPE_P(value) == IS_CONSTANT_AST) {
|
||||
SAVE_OPLINE();
|
||||
if (UNEXPECTED(zval_update_constant_ex(value, EX(func)->op_array.scope) != SUCCESS)) {
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
@ -8735,7 +8735,7 @@ ZEND_VM_HANDLER(183, ZEND_BIND_STATIC, CV, UNUSED, REF)
|
|||
ZVAL_COPY(variable_ptr, value);
|
||||
}
|
||||
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
ZEND_VM_HOT_HANDLER(184, ZEND_FETCH_THIS, UNUSED, UNUSED)
|
||||
|
|
|
@ -47303,9 +47303,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_STATIC_SPEC_CV_UNUSED_HAN
|
|||
|
||||
value = (zval*)((char*)ht->arData + (opline->extended_value & ~(ZEND_BIND_REF|ZEND_BIND_IMPLICIT|ZEND_BIND_EXPLICIT)));
|
||||
|
||||
SAVE_OPLINE();
|
||||
if (opline->extended_value & ZEND_BIND_REF) {
|
||||
if (Z_TYPE_P(value) == IS_CONSTANT_AST) {
|
||||
SAVE_OPLINE();
|
||||
if (UNEXPECTED(zval_update_constant_ex(value, EX(func)->op_array.scope) != SUCCESS)) {
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
@ -47330,7 +47330,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_STATIC_SPEC_CV_UNUSED_HAN
|
|||
ZVAL_COPY(variable_ptr, value);
|
||||
}
|
||||
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CHECK_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue