diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2006-04-05 02:28:06 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2006-04-05 02:28:06 +0000 |
commit | f0cf877a81b769aa73f81d9b6c0ebec5f85185c2 (patch) | |
tree | 6a23ec8c173bcfc0c9042985a35781a2edbeb9e4 | |
parent | c58e1fa5be5c1daaac1c188597e569449c4258fe (diff) | |
download | php-git-f0cf877a81b769aa73f81d9b6c0ebec5f85185c2.tar.gz |
Fixed bug #36957 (serialize() does not handle recursion).
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | ext/standard/var.c | 10 |
2 files changed, 10 insertions, 1 deletions
@@ -13,6 +13,7 @@ PHP NEWS - Removed the E_STRICT deprecation notice from "var". (Ilia) - Fixed debug_zval_dump() to support private and protected members. (Dmitry) - Fixed SoapFault::getMessage(). (Dmitry) +- Fixed bug #36957 (serialize() does not handle recursion). (Ilia) - Fixed bug #36941 (ArrayIterator does not clone itself). (Marcus) - Fixed bug #36898 (__set() leaks in classes extending internal ones). (Tony, Dmitry) diff --git a/ext/standard/var.c b/ext/standard/var.c index 7d107f171a..5a8bb152fd 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -815,10 +815,18 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va if (zend_hash_get_current_data_ex(myht, (void **) &data, &pos) != SUCCESS || !data - || data == struc) { + || data == struc + || (Z_TYPE_PP(data) == IS_ARRAY && Z_ARRVAL_PP(data)->nApplyCount > 1) + ) { smart_str_appendl(buf, "N;", 2); } else { + if (Z_TYPE_PP(data) == IS_ARRAY) { + Z_ARRVAL_PP(data)->nApplyCount++; + } php_var_serialize_intern(buf, data, var_hash TSRMLS_CC); + if (Z_TYPE_PP(data) == IS_ARRAY) { + Z_ARRVAL_PP(data)->nApplyCount--; + } } } } |