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

index 3a24111baa6d4ce26cac15290918ec7a2112ea5d..40d9fc953e7734068641141c06d7d3d5480cf3cc 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;
                }
@@ -882,6 +888,8 @@ yy86:
                return 0;
        }
 
+       if (*rval == *rval_ref) return 0;
+
        if (*rval != NULL) {
        zval_ptr_dtor(rval);
        }
index 1cf6ef5b5cf52c5307ba372026dfdaeebaf511d2..f04b06dcd166431ce5855f91ca6612ec257fc037 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;
                }
@@ -332,6 +338,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);