* PHP-7.4:
Fix bug #79599 in a different way
Revert "Fixed bug #97599 (coredump in set_error_handler)"
--- /dev/null
-string(21) "Undefined variable: b"
-string(21) "Undefined variable: b"
+ --TEST--
+ Bug #79599 (coredump in set_error_handler)
+ --FILE--
+ <?php
+ set_error_handler(function($code, $message){
+ throw new \Exception($message);
+ });
+ function test1(){
+ $a[] = $b;
+ }
+ function test2(){
+ $a[$c] = $b;
+ }
+ try{
+ test1();
+ }catch(\Exception $e){
+ var_dump($e->getMessage());
+ }
+ try{
+ test2();
+ }catch(\Exception $e){
+ var_dump($e->getMessage());
+ }
+ ?>
+ --EXPECT--
++string(21) "Undefined variable $b"
++string(21) "Undefined variable $c"
ZEND_VM_C_GOTO(try_assign_dim_array);
}
} else {
- if (OP1_TYPE != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
ZEND_VM_C_LABEL(assign_dim_error):
- FREE_UNFETCHED_OP_DATA();
+ FREE_OP_DATA();
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
}