]> granicus.if.org Git - php/commitdiff
MFH
authorStefan Esser <sesser@php.net>
Fri, 3 Dec 2004 16:04:10 +0000 (16:04 +0000)
committerStefan Esser <sesser@php.net>
Fri, 3 Dec 2004 16:04:10 +0000 (16:04 +0000)
ext/standard/var_unserializer.c
ext/standard/var_unserializer.re

index d95a31dace118fcb65e1383d814ebed91ccdbb04..10fe32cd3fc50947a999852c4b27a07eb749adc2 100644 (file)
@@ -205,9 +205,15 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, int
 
                switch (Z_TYPE_P(key)) {
                        case IS_LONG:
+                               if (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)) {
+                                       var_replace(var_hash, old_data, rval);
+                               }
                                zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);
                                break;
                        case IS_STRING:
+                               if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)) {
+                                       var_replace(var_hash, old_data, rval);
+                               }
                                zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
                                break;
                }
@@ -947,6 +953,8 @@ yy86:
        if (id == -1 || var_access(var_hash, id, &rval_ref) != SUCCESS) {
                return 0;
        }
+       
+       if (*rval == *rval_ref) return 0;
 
        if (*rval != NULL) {
                zval_ptr_dtor(rval);
index 5da3eb3e1bf3b62e11d562f91ec0864998e8942a..39343b73fd124669eda60a4244766fa475b0a07a 100644 (file)
@@ -208,9 +208,15 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, int
 
                switch (Z_TYPE_P(key)) {
                        case IS_LONG:
+                               if (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)) {
+                                       var_replace(var_hash, old_data, rval);
+                               }
                                zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);
                                break;
                        case IS_STRING:
+                               if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)) {
+                                       var_replace(var_hash, old_data, rval);
+                               }
                                zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
                                break;
                }
@@ -320,6 +326,8 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
        if (id == -1 || var_access(var_hash, id, &rval_ref) != SUCCESS) {
                return 0;
        }
+       
+       if (*rval == *rval_ref) return 0;
 
        if (*rval != NULL) {
                zval_ptr_dtor(rval);