Skip to content

Commit

Permalink
MFH
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Esser committed Dec 3, 2004
1 parent bc0b61d commit 0520c88
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ext/standard/var_unserializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -882,6 +888,8 @@ yy85: yych = *++YYCURSOR;
return 0;
}

if (*rval == *rval_ref) return 0;

if (*rval != NULL) {
zval_ptr_dtor(rval);
}
Expand Down
8 changes: 8 additions & 0 deletions ext/standard/var_unserializer.re
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0520c88

Please sign in to comment.