1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
BP_VAR_UNSET should not result in undefined warnings.
This commit is contained in:
Nikita Popov
2021-08-24 15:05:53 +02:00
parent be5078647e
commit a40ccd758c
4 changed files with 22 additions and 8 deletions

3
NEWS
View File

@@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.1.0RC1
- Core:
. Fixed bug #81377 (unset() of $GLOBALS sub-key yields warning). (Nikita)
- COM:
. Dispatch using LANG_NEUTRAL instead of LOCALE_SYSTEM_DEFAULT. (Dmitry
Maksimov)

11
Zend/tests/bug81377.phpt Normal file
View File

@@ -0,0 +1,11 @@
--TEST--
Bug #81377: unset() of $GLOBALS sub-key yields warning
--FILE--
<?php
unset($GLOBALS['foo']['bar']);
?>
===DONE==
--EXPECT--
===DONE==

View File

@@ -1730,7 +1730,7 @@ ZEND_VM_C_LABEL(fetch_this):
}
if (type == BP_VAR_W) {
retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval));
} else if (type == BP_VAR_IS) {
} else if (type == BP_VAR_IS || type == BP_VAR_UNSET) {
retval = &EG(uninitialized_zval);
} else {
zend_error(E_WARNING, "Undefined %svariable $%s",
@@ -1750,7 +1750,7 @@ ZEND_VM_C_LABEL(fetch_this):
}
if (type == BP_VAR_W) {
ZVAL_NULL(retval);
} else if (type == BP_VAR_IS) {
} else if (type == BP_VAR_IS || type == BP_VAR_UNSET) {
retval = &EG(uninitialized_zval);
} else {
zend_error(E_WARNING, "Undefined %svariable $%s",

View File

@@ -9690,7 +9690,7 @@ fetch_this:
}
if (type == BP_VAR_W) {
retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval));
} else if (type == BP_VAR_IS) {
} else if (type == BP_VAR_IS || type == BP_VAR_UNSET) {
retval = &EG(uninitialized_zval);
} else {
zend_error(E_WARNING, "Undefined %svariable $%s",
@@ -9710,7 +9710,7 @@ fetch_this:
}
if (type == BP_VAR_W) {
ZVAL_NULL(retval);
} else if (type == BP_VAR_IS) {
} else if (type == BP_VAR_IS || type == BP_VAR_UNSET) {
retval = &EG(uninitialized_zval);
} else {
zend_error(E_WARNING, "Undefined %svariable $%s",
@@ -17522,7 +17522,7 @@ fetch_this:
}
if (type == BP_VAR_W) {
retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval));
} else if (type == BP_VAR_IS) {
} else if (type == BP_VAR_IS || type == BP_VAR_UNSET) {
retval = &EG(uninitialized_zval);
} else {
zend_error(E_WARNING, "Undefined %svariable $%s",
@@ -17542,7 +17542,7 @@ fetch_this:
}
if (type == BP_VAR_W) {
ZVAL_NULL(retval);
} else if (type == BP_VAR_IS) {
} else if (type == BP_VAR_IS || type == BP_VAR_UNSET) {
retval = &EG(uninitialized_zval);
} else {
zend_error(E_WARNING, "Undefined %svariable $%s",
@@ -45966,7 +45966,7 @@ fetch_this:
}
if (type == BP_VAR_W) {
retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval));
} else if (type == BP_VAR_IS) {
} else if (type == BP_VAR_IS || type == BP_VAR_UNSET) {
retval = &EG(uninitialized_zval);
} else {
zend_error(E_WARNING, "Undefined %svariable $%s",
@@ -45986,7 +45986,7 @@ fetch_this:
}
if (type == BP_VAR_W) {
ZVAL_NULL(retval);
} else if (type == BP_VAR_IS) {
} else if (type == BP_VAR_IS || type == BP_VAR_UNSET) {
retval = &EG(uninitialized_zval);
} else {
zend_error(E_WARNING, "Undefined %svariable $%s",