summaryrefslogtreecommitdiff
path: root/ext/standard/var.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-08-11 03:22:24 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-08-11 03:22:24 +0000
commit4320c6994f0f84929141ea2543d95505e465b5d4 (patch)
tree464f7af081bb9b5a66574f1b9e4914e0798713fd /ext/standard/var.c
parentda30777de56bb182a407a140776dea6bc740c310 (diff)
downloadphp-git-4320c6994f0f84929141ea2543d95505e465b5d4.tar.gz
Fixed bug #21957 (serialize() mangles objects with __sleep).
Diffstat (limited to 'ext/standard/var.c')
-rw-r--r--ext/standard/var.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 33e73d351e..eac33b05d3 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -483,7 +483,7 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
"serialize.");
/* we should still add element even if it's not OK,
since we already wrote the length of the array before */
- smart_str_appendl(buf,"s:0:\"\";N;", 9);
+ smart_str_appendl(buf,"N;", 2);
continue;
}
@@ -565,6 +565,9 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only "
"containing the names of instance-variables to "
"serialize.");
+ /* we should still add element even if it's not OK,
+ since we already wrote the length of the array before */
+ smart_str_appendl(buf,"N;", 2);
}
zval_ptr_dtor(&retval_ptr);