summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMagnus M��tt� <magnus@php.net>2004-07-15 11:52:04 +0000
committerMagnus M��tt� <magnus@php.net>2004-07-15 11:52:04 +0000
commitcfc8accd3ed81fdb038cf6498b3967719fda0f39 (patch)
treeeaf5d5be92a0b5303344c91b25714838df530783 /tests
parentf6eb507b2c25eb6f52f2eb7b8c4b1587382cc24c (diff)
downloadphp-git-cfc8accd3ed81fdb038cf6498b3967719fda0f39.tar.gz
Test for bug 26737:
Protected and private variables are not saved on serialization when a user defined __sleep is used.
Diffstat (limited to 'tests')
-rw-r--r--tests/classes/bug26737.phpt21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/classes/bug26737.phpt b/tests/classes/bug26737.phpt
new file mode 100644
index 0000000000..de37eaffbc
--- /dev/null
+++ b/tests/classes/bug26737.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #26737 (Protected and private variables are not saved on serialization when a user defined __sleep is used)
+--FILE--
+<?php
+class foo
+{
+ private $private = 'private';
+ protected $protected = 'protected';
+ public $public = 'public';
+
+ public function __sleep()
+ {
+ return array('private', 'protected', 'public');
+ }
+}
+$foo = new foo();
+$data = serialize($foo);
+var_dump(str_replace("\0", '\0', $data));
+?>
+--EXPECT--
+string(114) "O:3:"foo":3:{s:12:"\0foo\0private";s:7:"private";s:12:"\0*\0protected";s:9:"protected";s:6:"public";s:6:"public";}"