]> granicus.if.org Git - php/commitdiff
- Unit test for bug #41528
authorDavid Coallier <davidc@php.net>
Wed, 12 Dec 2007 00:34:06 +0000 (00:34 +0000)
committerDavid Coallier <davidc@php.net>
Wed, 12 Dec 2007 00:34:06 +0000 (00:34 +0000)
- Checking that when you serialize a class that extends to ArrayObject
  Is keeping it's properties.

ext/spl/tests/bug41528.phpt [new file with mode: 0644]

diff --git a/ext/spl/tests/bug41528.phpt b/ext/spl/tests/bug41528.phpt
new file mode 100644 (file)
index 0000000..6be82c1
--- /dev/null
@@ -0,0 +1,37 @@
+--TEST--
+Bug #41528 (Classes extending ArrayObject do not serialize correctly)
+--FILE--
+<?php
+class ClassOne extends ArrayObject
+{
+    public $a = 2;
+}
+
+$classOne    = new ClassOne();
+$classOne->a = 1;
+
+var_dump($classOne);
+var_dump($classOne->a);
+
+$classOne = unserialize(serialize($classOne));
+
+var_dump($classOne);
+var_dump($classOne->a);
+?>
+--EXPECT--
+object(ClassOne)#1 (2) {
+  ["a"]=>
+  int(1)
+  ["storage":"ArrayObject":private]=>
+  array(0) {
+  }
+}
+int(1)
+object(ClassOne)#2 (2) {
+  ["a"]=>
+  int(1)
+  ["storage":"ArrayObject":private]=>
+  array(0) {
+  }
+}
+int(1)