@@ -9755,13 +9755,20 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_ad
9755
9755
} else if (type == BP_VAR_IS || type == BP_VAR_UNSET) {
9756
9756
retval = &EG(uninitialized_zval);
9757
9757
} else {
9758
+ if (IS_CONST == IS_CV) {
9759
+ /* Keep name alive in case an error handler tries to free it. */
9760
+ zend_string_addref(name);
9761
+ }
9758
9762
zend_error(E_WARNING, "Undefined %svariable $%s",
9759
9763
(opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), ZSTR_VAL(name));
9760
9764
if (type == BP_VAR_RW && !EG(exception)) {
9761
9765
retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval));
9762
9766
} else {
9763
9767
retval = &EG(uninitialized_zval);
9764
9768
}
9769
+ if (IS_CONST == IS_CV) {
9770
+ zend_string_release(name);
9771
+ }
9765
9772
}
9766
9773
/* GLOBAL or $$name variable may be an INDIRECT pointer to CV */
9767
9774
} else if (Z_TYPE_P(retval) == IS_INDIRECT) {
@@ -17560,13 +17567,20 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_ad
17560
17567
} else if (type == BP_VAR_IS || type == BP_VAR_UNSET) {
17561
17568
retval = &EG(uninitialized_zval);
17562
17569
} else {
17570
+ if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
17571
+ /* Keep name alive in case an error handler tries to free it. */
17572
+ zend_string_addref(name);
17573
+ }
17563
17574
zend_error(E_WARNING, "Undefined %svariable $%s",
17564
17575
(opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), ZSTR_VAL(name));
17565
17576
if (type == BP_VAR_RW && !EG(exception)) {
17566
17577
retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval));
17567
17578
} else {
17568
17579
retval = &EG(uninitialized_zval);
17569
17580
}
17581
+ if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
17582
+ zend_string_release(name);
17583
+ }
17570
17584
}
17571
17585
/* GLOBAL or $$name variable may be an INDIRECT pointer to CV */
17572
17586
} else if (Z_TYPE_P(retval) == IS_INDIRECT) {
@@ -47008,13 +47022,20 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_ad
47008
47022
} else if (type == BP_VAR_IS || type == BP_VAR_UNSET) {
47009
47023
retval = &EG(uninitialized_zval);
47010
47024
} else {
47025
+ if (IS_CV == IS_CV) {
47026
+ /* Keep name alive in case an error handler tries to free it. */
47027
+ zend_string_addref(name);
47028
+ }
47011
47029
zend_error(E_WARNING, "Undefined %svariable $%s",
47012
47030
(opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), ZSTR_VAL(name));
47013
47031
if (type == BP_VAR_RW && !EG(exception)) {
47014
47032
retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval));
47015
47033
} else {
47016
47034
retval = &EG(uninitialized_zval);
47017
47035
}
47036
+ if (IS_CV == IS_CV) {
47037
+ zend_string_release(name);
47038
+ }
47018
47039
}
47019
47040
/* GLOBAL or $$name variable may be an INDIRECT pointer to CV */
47020
47041
} else if (Z_TYPE_P(retval) == IS_INDIRECT) {
0 commit comments