cvs: php-src /ext/standard var.c
| From: | Ilia Alshanetsky | Date: | Wed, 05 Apr 2006 02:28:39 +0000 |
| Subject: | cvs: php-src /ext/standard var.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-37657@lists.php.net to get a copy of this message | ||
iliaa Wed Apr 5 02:28:39 2006 UTC
Modified files:
/php-src/ext/standard var.c
Log:
Fixed bug #36957 (serialize() does not handle recursion).
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/var.c?r1=1.229&r2=1.230&diff_format=u
Index: php-src/ext/standard/var.c
diff -u php-src/ext/standard/var.c:1.229 php-src/ext/standard/var.c:1.230
--- php-src/ext/standard/var.c:1.229 Mon Mar 27 22:16:53 2006
+++ php-src/ext/standard/var.c Wed Apr 5 02:28:39 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var.c,v 1.229 2006/03/27 22:16:53 andrei Exp $ */
+/* $Id: var.c,v 1.230 2006/04/05 02:28:39 iliaa Exp $ */
@@ -1031,10 +1031,18 @@
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--;
+ }
}
}
}