]> granicus.if.org Git - php/commitdiff
- Make unset consistent with the way array offsets work
authorAndi Gutmans <andi@php.net>
Fri, 9 Jun 2000 13:07:26 +0000 (13:07 +0000)
committerAndi Gutmans <andi@php.net>
Fri, 9 Jun 2000 13:07:26 +0000 (13:07 +0000)
Zend/zend_execute.c

index 77b1ac6fd3c4a4754a487625e8f94da56e2ab5f6..ebec3c0e994afa6a29f95a1652158024f23755ce 100644 (file)
@@ -2159,16 +2159,31 @@ send_by_ref:
                                                                ht = NULL;
                                                                break;
                                                }
-                                               if (ht) {
+                                               if (ht) {
                                                        switch (offset->type) {
+                                                               case IS_DOUBLE:
+                                                               case IS_RESOURCE:
+                                                               case IS_BOOL: 
                                                                case IS_LONG:
-                                                                       zend_hash_index_del(ht, offset->value.lval);
+                                                                       {
+                                                                               long index;
+
+                                                                               if (offset->type == IS_DOUBLE) {
+                                                                                       index = (long) offset->value.lval;
+                                                                               } else {
+                                                                                       index = offset->value.lval;
+                                                                               }
+                                                                               zend_hash_index_del(ht, index);
+                                                                               break;
+                                                                       }
+                                                               case IS_STRING:
+                                                                       zend_hash_del(ht, offset->value.str.val, offset->value.str.len+1);
                                                                        break;
                                                                case IS_NULL:
-                                                                       zend_hash_del(ht,"",1);
+                                                                       zend_hash_del(ht, "", sizeof(""));
                                                                        break;
-                                                               case IS_STRING:
-                                                                       zend_hash_del(ht, offset->value.str.val, offset->value.str.len+1);
+                                                               default: 
+                                                                       zend_error(E_WARNING, "Illegal offset type in unset");
                                                                        break;
                                                        }
                                                }