mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Fixed unset() bug that was introduced with CV optimization patch
This commit is contained in:
parent
3f35c6a6cc
commit
3d383e45dc
21
Zend/tests/unset_cv11.phpt
Normal file
21
Zend/tests/unset_cv11.phpt
Normal file
@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
unset() CV 11 (unset() of copy destoies original value)
|
||||
--FILE--
|
||||
<?php
|
||||
$x = array("default"=>"ok");
|
||||
var_dump($x);
|
||||
$cf = $x;
|
||||
unset($cf['default']);
|
||||
var_dump($x);
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["default"]=>
|
||||
string(2) "ok"
|
||||
}
|
||||
array(1) {
|
||||
["default"]=>
|
||||
string(2) "ok"
|
||||
}
|
||||
ok
|
@ -195,6 +195,7 @@ static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, zend_free_op *
|
||||
if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
|
||||
switch (type) {
|
||||
case BP_VAR_R:
|
||||
case BP_VAR_UNSET:
|
||||
zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_IS:
|
||||
@ -228,6 +229,7 @@ static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts, zend_free
|
||||
if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
|
||||
switch (type) {
|
||||
case BP_VAR_R:
|
||||
case BP_VAR_UNSET:
|
||||
zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_IS:
|
||||
@ -315,6 +317,7 @@ static inline zval *_get_zval_ptr_cv(znode *node, temp_variable *Ts, zend_free_o
|
||||
if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
|
||||
switch (type) {
|
||||
case BP_VAR_R:
|
||||
case BP_VAR_UNSET:
|
||||
zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_IS:
|
||||
@ -373,6 +376,7 @@ static inline zval **_get_zval_ptr_ptr_cv(znode *node, temp_variable *Ts, zend_f
|
||||
if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
|
||||
switch (type) {
|
||||
case BP_VAR_R:
|
||||
case BP_VAR_UNSET:
|
||||
zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_IS:
|
||||
|
@ -3238,13 +3238,16 @@ ZEND_VM_HANDLER(ZEND_UNSET_DIM_OBJ)
|
||||
{
|
||||
zend_op *opline = EX(opline);
|
||||
zend_free_op free_op1, free_op2;
|
||||
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_R);
|
||||
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
|
||||
zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
long index;
|
||||
|
||||
if (container) {
|
||||
HashTable *ht;
|
||||
|
||||
if (OP1_TYPE == IS_CV && container != &EG(uninitialized_zval_ptr)) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(container);
|
||||
}
|
||||
if (opline->extended_value == ZEND_UNSET_DIM) {
|
||||
switch (Z_TYPE_PP(container)) {
|
||||
case IS_ARRAY:
|
||||
|
Loading…
Reference in New Issue
Block a user