davidc Fri Dec 14 04:23:09 2007 UTC
Added files:
/php-src/ext/spl/tests array_023.phpt
Modified files:
/php-src/ext/spl/tests bug41528.phpt
Log:
- MFB: Merged bug41528.phpt test from 5_3
- Added a very similar test but this one just makes sure we keep
all the properties of the class members that we just serialized
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug41528.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/spl/tests/bug41528.phpt
diff -u /dev/null php-src/ext/spl/tests/bug41528.phpt:1.2
--- /dev/null Fri Dec 14 04:23:09 2007
+++ php-src/ext/spl/tests/bug41528.phpt Fri Dec 14 04:23:09 2007
@@ -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)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/array_023.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/array_023.phpt
+++ php-src/ext/spl/tests/array_023.phpt
--TEST--
Testing class extending to ArrayObject and serialize
--FILE--
<?php
class Name extends ArrayObject
{
public $var = 'a';
protected $bar = 'b';
private $foo = 'c';
}
$a = new Name();
var_dump($a);
var_dump($a->var);
$a = unserialize(serialize($a));
var_dump($a);
var_dump($a->var);
?>
--EXPECT--
object(Name)#1 (4) {
["var"]=>
string(1) "a"
["bar":protected]=>
string(1) "b"
["foo":"Name":private]=>
string(1) "c"
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(1) "a"
object(Name)#2 (4) {
["var"]=>
string(1) "a"
["bar":protected]=>
string(1) "b"
["foo":"Name":private]=>
string(1) "c"
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(1) "a"
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php