mirror of
https://github.com/php/php-src.git
synced 2024-11-27 11:53:33 +08:00
Fix FE_FETCH_* exception check
Only applying this for 7.2, because handling this would be ugly under the old retval freeing semantics.
This commit is contained in:
parent
ed37ca7369
commit
c136afa2be
22
Zend/tests/fe_fetch_dtor_exception.phpt
Normal file
22
Zend/tests/fe_fetch_dtor_exception.phpt
Normal file
@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Dtor may throw exception furing FE_FETCH assignment
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$v = new class {
|
||||
function __destruct() {
|
||||
throw new Exception("foo");
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
foreach ([1, 2] as $v) {
|
||||
var_dump($v);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
foo
|
@ -5954,7 +5954,7 @@ ZEND_VM_C_LABEL(fe_fetch_r_exit):
|
||||
GC_REFCOUNT(gc)++;
|
||||
}
|
||||
}
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(126, ZEND_FE_FETCH_RW, VAR, ANY, JMP_ADDR)
|
||||
@ -6128,7 +6128,7 @@ ZEND_VM_C_LABEL(fe_fetch_w_exit):
|
||||
Z_ADDREF_P(value);
|
||||
ZVAL_REF(EX_VAR(opline->op2.var), Z_REF_P(value));
|
||||
}
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH|ISSET)
|
||||
@ -8803,7 +8803,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_FE_FETCH_R, op->op2_type == IS_CV && (op1_inf
|
||||
|
||||
variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(opline->op2.var EXECUTE_DATA_CC);
|
||||
zend_assign_to_variable(variable_ptr, value, IS_CV);
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
ZEND_VM_DEFINE_OP(137, ZEND_OP_DATA);
|
||||
|
@ -16872,7 +16872,7 @@ fe_fetch_r_exit:
|
||||
GC_REFCOUNT(gc)++;
|
||||
}
|
||||
}
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_FETCH_RW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
@ -17046,7 +17046,7 @@ fe_fetch_w_exit:
|
||||
Z_ADDREF_P(value);
|
||||
ZVAL_REF(EX_VAR(opline->op2.var), Z_REF_P(value));
|
||||
}
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
@ -24261,7 +24261,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_FETCH_R_SIMPLE_
|
||||
|
||||
variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(opline->op2.var EXECUTE_DATA_CC);
|
||||
zend_assign_to_variable(variable_ptr, value, IS_CV);
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
|
||||
@ -24313,7 +24313,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_FETCH_R_SIMPLE_
|
||||
|
||||
variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(opline->op2.var EXECUTE_DATA_CC);
|
||||
zend_assign_to_variable(variable_ptr, value, IS_CV);
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user