summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2003-08-11 03:22:25 +0000
committerSVN Migration <svn@php.net>2003-08-11 03:22:25 +0000
commit3f54dd40b6bc0a0ced2c265c1f989999aef510f6 (patch)
tree199d1771fff8427efc2fe534b6ce11660b3d74c0 /ext/standard
parent7c0dd1251cd481afe78d382027fb09ddc85dade2 (diff)
downloadphp-git-3f54dd40b6bc0a0ced2c265c1f989999aef510f6.tar.gz
This commit was manufactured by cvs2svn to create branch 'PHP_4_3'.
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/tests/serialize/bug21957.phpt49
1 files changed, 49 insertions, 0 deletions
diff --git a/ext/standard/tests/serialize/bug21957.phpt b/ext/standard/tests/serialize/bug21957.phpt
new file mode 100644
index 0000000000..af2003f3e3
--- /dev/null
+++ b/ext/standard/tests/serialize/bug21957.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Bug #21957 (serialize() mangles objects with __sleep)
+--FILE--
+<?php
+class test
+{
+ var $a, $b;
+
+ function test()
+ {
+ $this->a = 7;
+ $this->b = 2;
+ }
+
+ function __sleep()
+ {
+ $this->b = 0;
+ }
+}
+
+$t['one'] = 'ABC';
+$t['two'] = new test();
+
+var_dump($t);
+
+$s = @serialize($t);
+echo $s . "\n";
+
+var_dump(unserialize($s));
+?>
+--EXPECT--
+array(2) {
+ ["one"]=>
+ string(3) "ABC"
+ ["two"]=>
+ object(test)#1 (2) {
+ ["a"]=>
+ int(7)
+ ["b"]=>
+ int(2)
+ }
+}
+a:2:{s:3:"one";s:3:"ABC";s:3:"two";N;}
+array(2) {
+ ["one"]=>
+ string(3) "ABC"
+ ["two"]=>
+ NULL
+}