summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorThomas Punt <tpunt@hotmail.co.uk>2017-04-01 15:37:48 +0100
committerNikita Popov <nikita.ppv@gmail.com>2017-04-09 15:29:31 +0200
commit744c4a5592ab3e8a733d68fbfe8913081fb6c1bc (patch)
tree0157ef5523bfbec6dfee08162b43c92aa177c435 /Zend
parentba6561d3cc5ef8c2d5a698622586e7aa28e76f5a (diff)
downloadphp-git-744c4a5592ab3e8a733d68fbfe8913081fb6c1bc.tar.gz
Resolve bug #74188 (undefined statics raising with ?? operator)
Diffstat (limited to 'Zend')
-rw-r--r--Zend/tests/bug74188.phpt14
-rw-r--r--Zend/zend_vm_def.h30
-rw-r--r--Zend/zend_vm_execute.h246
3 files changed, 212 insertions, 78 deletions
diff --git a/Zend/tests/bug74188.phpt b/Zend/tests/bug74188.phpt
new file mode 100644
index 0000000000..3eb4facdd9
--- /dev/null
+++ b/Zend/tests/bug74188.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Fixes bug 74188 (undeclared static variables emit a warning with ?? operator)
+--FILE--
+<?php
+abstract class Test
+{
+ public static function get()
+ {
+ static::$a ?? true;
+ }
+}
+Test::get();
+?>
+--EXPECT--
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index f5d8899324..a5ff72b668 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -1515,9 +1515,13 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED|CONST|V
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- FREE_OP1();
- HANDLE_EXCEPTION();
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ FREE_OP1();
+ HANDLE_EXCEPTION();
+ }
}
ZEND_VM_C_GOTO(fetch_var_return);
@@ -1539,15 +1543,19 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED|CONST|V
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- FREE_OP1();
- HANDLE_EXCEPTION();
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ FREE_OP1();
+ HANDLE_EXCEPTION();
+ }
}
ZEND_VM_C_GOTO(fetch_var_return);
}
}
- retval = zend_std_get_static_property(ce, name, 0);
+ retval = zend_std_get_static_property(ce, name, type == BP_VAR_IS);
if (UNEXPECTED(EG(exception))) {
if (OP1_TYPE != IS_CONST) {
zend_string_release(name);
@@ -1555,8 +1563,12 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED|CONST|V
FREE_OP1();
HANDLE_EXCEPTION();
}
- if (OP1_TYPE == IS_CONST && retval) {
- CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ if (retval) {
+ if (OP1_TYPE == IS_CONST) {
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ }
+ } else {
+ retval = &EG(uninitialized_zval);
}
FREE_OP1();
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 8ac72ed2e8..7f2996387c 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -5007,9 +5007,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- HANDLE_EXCEPTION();
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
@@ -5031,15 +5035,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- HANDLE_EXCEPTION();
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
}
}
- retval = zend_std_get_static_property(ce, name, 0);
+ retval = zend_std_get_static_property(ce, name, type == BP_VAR_IS);
if (UNEXPECTED(EG(exception))) {
if (IS_CONST != IS_CONST) {
zend_string_release(name);
@@ -5047,8 +5055,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
HANDLE_EXCEPTION();
}
- if (IS_CONST == IS_CONST && retval) {
- CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ if (retval) {
+ if (IS_CONST == IS_CONST) {
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ }
+ } else {
+ retval = &EG(uninitialized_zval);
}
} else {
@@ -6963,9 +6975,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- HANDLE_EXCEPTION();
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
@@ -6987,15 +7003,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- HANDLE_EXCEPTION();
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
}
}
- retval = zend_std_get_static_property(ce, name, 0);
+ retval = zend_std_get_static_property(ce, name, type == BP_VAR_IS);
if (UNEXPECTED(EG(exception))) {
if (IS_CONST != IS_CONST) {
zend_string_release(name);
@@ -7003,8 +7023,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
HANDLE_EXCEPTION();
}
- if (IS_CONST == IS_CONST && retval) {
- CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ if (retval) {
+ if (IS_CONST == IS_CONST) {
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ }
+ } else {
+ retval = &EG(uninitialized_zval);
}
} else {
@@ -7469,9 +7493,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- HANDLE_EXCEPTION();
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
@@ -7493,15 +7521,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- HANDLE_EXCEPTION();
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
}
}
- retval = zend_std_get_static_property(ce, name, 0);
+ retval = zend_std_get_static_property(ce, name, type == BP_VAR_IS);
if (UNEXPECTED(EG(exception))) {
if (IS_CONST != IS_CONST) {
zend_string_release(name);
@@ -7509,8 +7541,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
HANDLE_EXCEPTION();
}
- if (IS_CONST == IS_CONST && retval) {
- CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ if (retval) {
+ if (IS_CONST == IS_CONST) {
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ }
+ } else {
+ retval = &EG(uninitialized_zval);
}
} else {
@@ -31389,9 +31425,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- HANDLE_EXCEPTION();
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
@@ -31413,15 +31453,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- HANDLE_EXCEPTION();
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
}
}
- retval = zend_std_get_static_property(ce, name, 0);
+ retval = zend_std_get_static_property(ce, name, type == BP_VAR_IS);
if (UNEXPECTED(EG(exception))) {
if (IS_CV != IS_CONST) {
zend_string_release(name);
@@ -31429,8 +31473,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
HANDLE_EXCEPTION();
}
- if (IS_CV == IS_CONST && retval) {
- CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ if (retval) {
+ if (IS_CV == IS_CONST) {
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ }
+ } else {
+ retval = &EG(uninitialized_zval);
}
} else {
@@ -33617,9 +33665,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- HANDLE_EXCEPTION();
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
@@ -33641,15 +33693,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- HANDLE_EXCEPTION();
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
}
}
- retval = zend_std_get_static_property(ce, name, 0);
+ retval = zend_std_get_static_property(ce, name, type == BP_VAR_IS);
if (UNEXPECTED(EG(exception))) {
if (IS_CV != IS_CONST) {
zend_string_release(name);
@@ -33657,8 +33713,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
HANDLE_EXCEPTION();
}
- if (IS_CV == IS_CONST && retval) {
- CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ if (retval) {
+ if (IS_CV == IS_CONST) {
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ }
+ } else {
+ retval = &EG(uninitialized_zval);
}
} else {
@@ -34565,9 +34625,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- HANDLE_EXCEPTION();
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
@@ -34589,15 +34653,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- HANDLE_EXCEPTION();
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
}
}
- retval = zend_std_get_static_property(ce, name, 0);
+ retval = zend_std_get_static_property(ce, name, type == BP_VAR_IS);
if (UNEXPECTED(EG(exception))) {
if (IS_CV != IS_CONST) {
zend_string_release(name);
@@ -34605,8 +34673,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
HANDLE_EXCEPTION();
}
- if (IS_CV == IS_CONST && retval) {
- CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ if (retval) {
+ if (IS_CV == IS_CONST) {
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ }
+ } else {
+ retval = &EG(uninitialized_zval);
}
} else {
@@ -41826,9 +41898,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- zval_ptr_dtor_nogc(free_op1);
- HANDLE_EXCEPTION();
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ zval_ptr_dtor_nogc(free_op1);
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
@@ -41850,15 +41926,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- zval_ptr_dtor_nogc(free_op1);
- HANDLE_EXCEPTION();
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ zval_ptr_dtor_nogc(free_op1);
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
}
}
- retval = zend_std_get_static_property(ce, name, 0);
+ retval = zend_std_get_static_property(ce, name, type == BP_VAR_IS);
if (UNEXPECTED(EG(exception))) {
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
zend_string_release(name);
@@ -41866,8 +41946,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
zval_ptr_dtor_nogc(free_op1);
HANDLE_EXCEPTION();
}
- if ((IS_TMP_VAR|IS_VAR) == IS_CONST && retval) {
- CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ if (retval) {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ }
+ } else {
+ retval = &EG(uninitialized_zval);
}
zval_ptr_dtor_nogc(free_op1);
@@ -42829,9 +42913,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- zval_ptr_dtor_nogc(free_op1);
- HANDLE_EXCEPTION();
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ zval_ptr_dtor_nogc(free_op1);
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
@@ -42853,15 +42941,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- zval_ptr_dtor_nogc(free_op1);
- HANDLE_EXCEPTION();
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ zval_ptr_dtor_nogc(free_op1);
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
}
}
- retval = zend_std_get_static_property(ce, name, 0);
+ retval = zend_std_get_static_property(ce, name, type == BP_VAR_IS);
if (UNEXPECTED(EG(exception))) {
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
zend_string_release(name);
@@ -42869,8 +42961,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
zval_ptr_dtor_nogc(free_op1);
HANDLE_EXCEPTION();
}
- if ((IS_TMP_VAR|IS_VAR) == IS_CONST && retval) {
- CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ if (retval) {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ }
+ } else {
+ retval = &EG(uninitialized_zval);
}
zval_ptr_dtor_nogc(free_op1);
@@ -43240,9 +43336,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- zval_ptr_dtor_nogc(free_op1);
- HANDLE_EXCEPTION();
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ zval_ptr_dtor_nogc(free_op1);
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
@@ -43264,15 +43364,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
/* check if static properties were destoyed */
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
- zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- zval_ptr_dtor_nogc(free_op1);
- HANDLE_EXCEPTION();
+ if (type == BP_VAR_IS) {
+ retval = &EG(uninitialized_zval);
+ } else {
+ zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ zval_ptr_dtor_nogc(free_op1);
+ HANDLE_EXCEPTION();
+ }
}
goto fetch_var_return;
}
}
- retval = zend_std_get_static_property(ce, name, 0);
+ retval = zend_std_get_static_property(ce, name, type == BP_VAR_IS);
if (UNEXPECTED(EG(exception))) {
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
zend_string_release(name);
@@ -43280,8 +43384,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
zval_ptr_dtor_nogc(free_op1);
HANDLE_EXCEPTION();
}
- if ((IS_TMP_VAR|IS_VAR) == IS_CONST && retval) {
- CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ if (retval) {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
+ }
+ } else {
+ retval = &EG(uninitialized_zval);
}
zval_ptr_dtor_nogc(free_op1);