dmitry Tue Oct 5 05:09:18 2004 EDT
Added files:
/ZendEngine2/tests unset_cv11.phpt
Modified files:
/ZendEngine2 zend_execute.c zend_vm_handlers.h
Log:
Fixed unset() bug that was introduced with CV optimization patch
http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.681&r2=1.682&ty=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.681 ZendEngine2/zend_execute.c:1.682
--- ZendEngine2/zend_execute.c:1.681 Mon Oct 4 15:54:34 2004
+++ ZendEngine2/zend_execute.c Tue Oct 5 05:09:12 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.681 2004/10/04 19:54:34 andi Exp $ */
+/* $Id: zend_execute.c,v 1.682 2004/10/05 09:09:12 dmitry Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -195,6 +195,7 @@
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 @@
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 @@
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 @@
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:
http://cvs.php.net/diff.php/ZendEngine2/zend_vm_handlers.h?r1=1.4&r2=1.5&ty=u
Index: ZendEngine2/zend_vm_handlers.h
diff -u ZendEngine2/zend_vm_handlers.h:1.4 ZendEngine2/zend_vm_handlers.h:1.5
--- ZendEngine2/zend_vm_handlers.h:1.4 Tue Oct 5 02:53:39 2004
+++ ZendEngine2/zend_vm_handlers.h Tue Oct 5 05:09:16 2004
@@ -3238,13 +3238,16 @@
{
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:
http://cvs.php.net/co.php/ZendEngine2/tests/unset_cv11.phpt?r=1.1&p=1
Index: ZendEngine2/tests/unset_cv11.phpt
+++ ZendEngine2/tests/unset_cv11.phpt
--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