From da591e8eca232ee7541bbb1dbf5c3be6f32ba284 Mon Sep 17 00:00:00 2001 From: Robin Fernandes Date: Tue, 18 Mar 2008 15:12:42 +0000 Subject: [PATCH] Adding more tests for serialize() and unserialize(). --- ext/standard/tests/serialize/005.phpt | 4 +- .../serialize/serialization_arrays_001.phpt | 177 +++ .../serialize/serialization_arrays_002.phpt | 986 +++++++++++++++ .../serialize/serialization_arrays_003.phpt | 516 ++++++++ .../serialize/serialization_arrays_004.phpt | 881 ++++++++++++++ .../serialize/serialization_arrays_005.phpt | 1062 +++++++++++++++++ .../serialize/serialization_error_001.phpt | 42 + .../serialization_miscTypes_001.phpt | Bin 0 -> 13226 bytes .../serialize/serialization_objects_001.phpt | Bin 0 -> 3680 bytes .../serialize/serialization_objects_002.phpt | Bin 0 -> 12462 bytes .../serialize/serialization_objects_003.phpt | 82 ++ .../serialize/serialization_objects_004.phpt | 57 + .../serialize/serialization_objects_005.phpt | 175 +++ .../serialize/serialization_objects_006.phpt | 28 + .../serialize/serialization_objects_007.phpt | 53 + .../serialize/serialization_objects_008.phpt | 36 + .../serialize/serialization_objects_009.phpt | 36 + .../serialize/serialization_objects_010.phpt | 37 + .../serialize/serialization_objects_011.phpt | 314 +++++ .../serialize/serialization_objects_012.phpt | 402 +++++++ .../serialize/serialization_objects_013.phpt | 890 ++++++++++++++ .../serialize/serialization_objects_014.phpt | 515 ++++++++ .../serialize/serialization_objects_015.phpt | 992 +++++++++++++++ .../serialization_precision_001.phpt | 23 + .../serialization_precision_002.phpt | 23 + .../serialization_resources_001.phpt | 36 + 26 files changed, 7365 insertions(+), 2 deletions(-) create mode 100644 ext/standard/tests/serialize/serialization_arrays_001.phpt create mode 100644 ext/standard/tests/serialize/serialization_arrays_002.phpt create mode 100644 ext/standard/tests/serialize/serialization_arrays_003.phpt create mode 100644 ext/standard/tests/serialize/serialization_arrays_004.phpt create mode 100644 ext/standard/tests/serialize/serialization_arrays_005.phpt create mode 100644 ext/standard/tests/serialize/serialization_error_001.phpt create mode 100644 ext/standard/tests/serialize/serialization_miscTypes_001.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_001.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_002.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_003.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_004.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_005.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_006.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_007.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_008.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_009.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_010.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_011.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_012.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_013.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_014.phpt create mode 100644 ext/standard/tests/serialize/serialization_objects_015.phpt create mode 100644 ext/standard/tests/serialize/serialization_precision_001.phpt create mode 100644 ext/standard/tests/serialize/serialization_precision_002.phpt create mode 100644 ext/standard/tests/serialize/serialization_resources_001.phpt diff --git a/ext/standard/tests/serialize/005.phpt b/ext/standard/tests/serialize/005.phpt index b958ded25b4..f2201b2dbf3 100755 --- a/ext/standard/tests/serialize/005.phpt +++ b/ext/standard/tests/serialize/005.phpt @@ -179,7 +179,7 @@ do_autoload(autoload_not_available) do_autoload(autoload_not_available) Warning: unserialize(): Function unserializer() hasn't defined the class it was called for in %s005.php on line %d -object(__PHP_Incomplete_Class)#1 (1) { +object(__PHP_Incomplete_Class)#%d (1) { ["__PHP_Incomplete_Class_Name"]=> string(22) "autoload_not_available" } @@ -231,7 +231,7 @@ do_autoload(autoload_not_available) do_autoload(autoload_not_available) Warning: unserialize(): Function unserializer() hasn't defined the class it was called for in %s005.php on line %d -object(__PHP_Incomplete_Class)#1 (1) { +object(__PHP_Incomplete_Class)#%d (1) { [u"__PHP_Incomplete_Class_Name"]=> unicode(22) "autoload_not_available" } diff --git a/ext/standard/tests/serialize/serialization_arrays_001.phpt b/ext/standard/tests/serialize/serialization_arrays_001.phpt new file mode 100644 index 00000000000..19c69b708fc --- /dev/null +++ b/ext/standard/tests/serialize/serialization_arrays_001.phpt @@ -0,0 +1,177 @@ +--TEST-- +Test serialize() & unserialize() functions: arrays (circular references) +--FILE-- + "test"); +$arr_asso[ "b" ] = &$arr_asso[ "a" ]; +var_dump($arr_asso); +$serialize_data = serialize($arr_asso); +var_dump($serialize_data); +$arr_asso = unserialize($serialize_data); +var_dump($arr_asso); + +echo "\nDone"; +?> +--EXPECTF-- + +--- Testing Circular reference of an array --- +-- Normal array -- +string(238) "a:7:{i:0;i:0;i:1;i:1;i:2;i:-2;i:3;d:3.333333000000000101437080957111902534961700439453125;i:4;S:1:"a";i:5;a:0:{}i:6;a:7:{i:0;i:0;i:1;i:1;i:2;i:-2;i:3;d:3.333333000000000101437080957111902534961700439453125;i:4;S:1:"a";i:5;a:0:{}i:6;R:8;}}" +array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-2) + [3]=> + float(3.333333) + [4]=> + string(1) "a" + [5]=> + array(0) { + } + [6]=> + &array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-2) + [3]=> + float(3.333333) + [4]=> + string(1) "a" + [5]=> + array(0) { + } + [6]=> + &array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-2) + [3]=> + float(3.333333) + [4]=> + string(1) "a" + [5]=> + array(0) { + } + [6]=> + *RECURSION* + } + } +} + +-- Associative array -- +array(2) { + ["a"]=> + &string(4) "test" + ["b"]=> + &string(4) "test" +} +string(37) "a:2:{S:1:"a";S:4:"test";S:1:"b";R:2;}" +array(2) { + ["a"]=> + &string(4) "test" + ["b"]=> + &string(4) "test" +} + +Done +--UEXPECTF-- + +--- Testing Circular reference of an array --- +-- Normal array -- +unicode(238) "a:7:{i:0;i:0;i:1;i:1;i:2;i:-2;i:3;d:3.333333000000000101437080957111902534961700439453125;i:4;U:1:"a";i:5;a:0:{}i:6;a:7:{i:0;i:0;i:1;i:1;i:2;i:-2;i:3;d:3.333333000000000101437080957111902534961700439453125;i:4;U:1:"a";i:5;a:0:{}i:6;R:8;}}" +array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-2) + [3]=> + float(3.333333) + [4]=> + unicode(1) "a" + [5]=> + array(0) { + } + [6]=> + &array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-2) + [3]=> + float(3.333333) + [4]=> + unicode(1) "a" + [5]=> + array(0) { + } + [6]=> + &array(7) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(-2) + [3]=> + float(3.333333) + [4]=> + unicode(1) "a" + [5]=> + array(0) { + } + [6]=> + *RECURSION* + } + } +} + +-- Associative array -- +array(2) { + [u"a"]=> + &unicode(4) "test" + [u"b"]=> + &unicode(4) "test" +} +unicode(37) "a:2:{U:1:"a";U:4:"test";U:1:"b";R:2;}" +array(2) { + [u"a"]=> + &unicode(4) "test" + [u"b"]=> + &unicode(4) "test" +} + +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_arrays_002.phpt b/ext/standard/tests/serialize/serialization_arrays_002.phpt new file mode 100644 index 00000000000..af3d1125a1b --- /dev/null +++ b/ext/standard/tests/serialize/serialization_arrays_002.phpt @@ -0,0 +1,986 @@ +--TEST-- +serialization: arrays with references amonst elements +--FILE-- + +--EXPECTF-- + + +--- No references: +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) +} +string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}" +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + string(10) "b2.changed" +} + + +--- 0 refs 1: +array(3) { + [1]=> + &int(1) + [0]=> + &int(1) + [2]=> + int(1) +} +string(30) "a:3:{i:1;i:1;i:0;R:2;i:2;i:1;}" +array(3) { + [1]=> + &int(1) + [0]=> + &int(1) + [2]=> + int(1) +} +array(3) { + [1]=> + &string(10) "b0.changed" + [0]=> + &string(10) "b0.changed" + [2]=> + int(1) +} +array(3) { + [1]=> + &string(10) "b1.changed" + [0]=> + &string(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [1]=> + &string(10) "b1.changed" + [0]=> + &string(10) "b1.changed" + [2]=> + string(10) "b2.changed" +} + + +--- 0 refs 2: +array(3) { + [2]=> + &int(1) + [0]=> + &int(1) + [1]=> + int(1) +} +string(30) "a:3:{i:2;i:1;i:0;R:2;i:1;i:1;}" +array(3) { + [2]=> + &int(1) + [0]=> + &int(1) + [1]=> + int(1) +} +array(3) { + [2]=> + &string(10) "b0.changed" + [0]=> + &string(10) "b0.changed" + [1]=> + int(1) +} +array(3) { + [2]=> + &string(10) "b0.changed" + [0]=> + &string(10) "b0.changed" + [1]=> + string(10) "b1.changed" +} +array(3) { + [2]=> + &string(10) "b2.changed" + [0]=> + &string(10) "b2.changed" + [1]=> + string(10) "b1.changed" +} + + +--- 1 refs 0: +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + int(1) +} +string(30) "a:3:{i:0;i:1;i:1;R:2;i:2;i:1;}" +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + &string(10) "b0.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + &string(10) "b1.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + &string(10) "b1.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + string(10) "b2.changed" +} + + +--- 1 refs 2: +array(3) { + [0]=> + int(1) + [2]=> + &int(1) + [1]=> + &int(1) +} +string(30) "a:3:{i:0;i:1;i:2;i:1;i:1;R:3;}" +array(3) { + [0]=> + int(1) + [2]=> + &int(1) + [1]=> + &int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [2]=> + &int(1) + [1]=> + &int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [2]=> + &string(10) "b1.changed" + [1]=> + &string(10) "b1.changed" +} +array(3) { + [0]=> + string(10) "b0.changed" + [2]=> + &string(10) "b2.changed" + [1]=> + &string(10) "b2.changed" +} + + +--- 2 refs 0: +array(3) { + [0]=> + &int(1) + [1]=> + int(1) + [2]=> + &int(1) +} +string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;R:2;}" +array(3) { + [0]=> + &int(1) + [1]=> + int(1) + [2]=> + &int(1) +} +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + int(1) + [2]=> + &string(10) "b0.changed" +} +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + &string(10) "b0.changed" +} +array(3) { + [0]=> + &string(10) "b2.changed" + [1]=> + string(10) "b1.changed" + [2]=> + &string(10) "b2.changed" +} + + +--- 2 refs 1: +array(3) { + [0]=> + int(1) + [1]=> + &int(1) + [2]=> + &int(1) +} +string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;R:3;}" +array(3) { + [0]=> + int(1) + [1]=> + &int(1) + [2]=> + &int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + &int(1) + [2]=> + &int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + &string(10) "b1.changed" +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + &string(10) "b2.changed" + [2]=> + &string(10) "b2.changed" +} + + +--- 0,1 ref 2: +array(3) { + [2]=> + &int(1) + [0]=> + &int(1) + [1]=> + &int(1) +} +string(30) "a:3:{i:2;i:1;i:0;R:2;i:1;R:2;}" +array(3) { + [2]=> + &int(1) + [0]=> + &int(1) + [1]=> + &int(1) +} +array(3) { + [2]=> + &string(10) "b0.changed" + [0]=> + &string(10) "b0.changed" + [1]=> + &string(10) "b0.changed" +} +array(3) { + [2]=> + &string(10) "b1.changed" + [0]=> + &string(10) "b1.changed" + [1]=> + &string(10) "b1.changed" +} +array(3) { + [2]=> + &string(10) "b2.changed" + [0]=> + &string(10) "b2.changed" + [1]=> + &string(10) "b2.changed" +} + + +--- 0,2 ref 1: +array(3) { + [1]=> + &int(1) + [0]=> + &int(1) + [2]=> + &int(1) +} +string(30) "a:3:{i:1;i:1;i:0;R:2;i:2;R:2;}" +array(3) { + [1]=> + &int(1) + [0]=> + &int(1) + [2]=> + &int(1) +} +array(3) { + [1]=> + &string(10) "b0.changed" + [0]=> + &string(10) "b0.changed" + [2]=> + &string(10) "b0.changed" +} +array(3) { + [1]=> + &string(10) "b1.changed" + [0]=> + &string(10) "b1.changed" + [2]=> + &string(10) "b1.changed" +} +array(3) { + [1]=> + &string(10) "b2.changed" + [0]=> + &string(10) "b2.changed" + [2]=> + &string(10) "b2.changed" +} + + +--- 1,2 ref 0: +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + &int(1) +} +string(30) "a:3:{i:0;i:1;i:1;R:2;i:2;R:2;}" +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + &int(1) +} +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + &string(10) "b0.changed" + [2]=> + &string(10) "b0.changed" +} +array(3) { + [0]=> + &string(10) "b1.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + &string(10) "b1.changed" +} +array(3) { + [0]=> + &string(10) "b2.changed" + [1]=> + &string(10) "b2.changed" + [2]=> + &string(10) "b2.changed" +} +Done +--UEXPECTF-- + + +--- No references: +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) +} +unicode(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}" +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + unicode(10) "b2.changed" +} + + +--- 0 refs 1: +array(3) { + [1]=> + &int(1) + [0]=> + &int(1) + [2]=> + int(1) +} +unicode(30) "a:3:{i:1;i:1;i:0;R:2;i:2;i:1;}" +array(3) { + [1]=> + &int(1) + [0]=> + &int(1) + [2]=> + int(1) +} +array(3) { + [1]=> + &unicode(10) "b0.changed" + [0]=> + &unicode(10) "b0.changed" + [2]=> + int(1) +} +array(3) { + [1]=> + &unicode(10) "b1.changed" + [0]=> + &unicode(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [1]=> + &unicode(10) "b1.changed" + [0]=> + &unicode(10) "b1.changed" + [2]=> + unicode(10) "b2.changed" +} + + +--- 0 refs 2: +array(3) { + [2]=> + &int(1) + [0]=> + &int(1) + [1]=> + int(1) +} +unicode(30) "a:3:{i:2;i:1;i:0;R:2;i:1;i:1;}" +array(3) { + [2]=> + &int(1) + [0]=> + &int(1) + [1]=> + int(1) +} +array(3) { + [2]=> + &unicode(10) "b0.changed" + [0]=> + &unicode(10) "b0.changed" + [1]=> + int(1) +} +array(3) { + [2]=> + &unicode(10) "b0.changed" + [0]=> + &unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" +} +array(3) { + [2]=> + &unicode(10) "b2.changed" + [0]=> + &unicode(10) "b2.changed" + [1]=> + unicode(10) "b1.changed" +} + + +--- 1 refs 0: +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + int(1) +} +unicode(30) "a:3:{i:0;i:1;i:1;R:2;i:2;i:1;}" +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &unicode(10) "b0.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + &unicode(10) "b1.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + &unicode(10) "b1.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + unicode(10) "b2.changed" +} + + +--- 1 refs 2: +array(3) { + [0]=> + int(1) + [2]=> + &int(1) + [1]=> + &int(1) +} +unicode(30) "a:3:{i:0;i:1;i:2;i:1;i:1;R:3;}" +array(3) { + [0]=> + int(1) + [2]=> + &int(1) + [1]=> + &int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [2]=> + &int(1) + [1]=> + &int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [2]=> + &unicode(10) "b1.changed" + [1]=> + &unicode(10) "b1.changed" +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [2]=> + &unicode(10) "b2.changed" + [1]=> + &unicode(10) "b2.changed" +} + + +--- 2 refs 0: +array(3) { + [0]=> + &int(1) + [1]=> + int(1) + [2]=> + &int(1) +} +unicode(30) "a:3:{i:0;i:1;i:1;i:1;i:2;R:2;}" +array(3) { + [0]=> + &int(1) + [1]=> + int(1) + [2]=> + &int(1) +} +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + int(1) + [2]=> + &unicode(10) "b0.changed" +} +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + &unicode(10) "b0.changed" +} +array(3) { + [0]=> + &unicode(10) "b2.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + &unicode(10) "b2.changed" +} + + +--- 2 refs 1: +array(3) { + [0]=> + int(1) + [1]=> + &int(1) + [2]=> + &int(1) +} +unicode(30) "a:3:{i:0;i:1;i:1;i:1;i:2;R:3;}" +array(3) { + [0]=> + int(1) + [1]=> + &int(1) + [2]=> + &int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + &int(1) + [2]=> + &int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + &unicode(10) "b1.changed" +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + &unicode(10) "b2.changed" + [2]=> + &unicode(10) "b2.changed" +} + + +--- 0,1 ref 2: +array(3) { + [2]=> + &int(1) + [0]=> + &int(1) + [1]=> + &int(1) +} +unicode(30) "a:3:{i:2;i:1;i:0;R:2;i:1;R:2;}" +array(3) { + [2]=> + &int(1) + [0]=> + &int(1) + [1]=> + &int(1) +} +array(3) { + [2]=> + &unicode(10) "b0.changed" + [0]=> + &unicode(10) "b0.changed" + [1]=> + &unicode(10) "b0.changed" +} +array(3) { + [2]=> + &unicode(10) "b1.changed" + [0]=> + &unicode(10) "b1.changed" + [1]=> + &unicode(10) "b1.changed" +} +array(3) { + [2]=> + &unicode(10) "b2.changed" + [0]=> + &unicode(10) "b2.changed" + [1]=> + &unicode(10) "b2.changed" +} + + +--- 0,2 ref 1: +array(3) { + [1]=> + &int(1) + [0]=> + &int(1) + [2]=> + &int(1) +} +unicode(30) "a:3:{i:1;i:1;i:0;R:2;i:2;R:2;}" +array(3) { + [1]=> + &int(1) + [0]=> + &int(1) + [2]=> + &int(1) +} +array(3) { + [1]=> + &unicode(10) "b0.changed" + [0]=> + &unicode(10) "b0.changed" + [2]=> + &unicode(10) "b0.changed" +} +array(3) { + [1]=> + &unicode(10) "b1.changed" + [0]=> + &unicode(10) "b1.changed" + [2]=> + &unicode(10) "b1.changed" +} +array(3) { + [1]=> + &unicode(10) "b2.changed" + [0]=> + &unicode(10) "b2.changed" + [2]=> + &unicode(10) "b2.changed" +} + + +--- 1,2 ref 0: +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + &int(1) +} +unicode(30) "a:3:{i:0;i:1;i:1;R:2;i:2;R:2;}" +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + &int(1) +} +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &unicode(10) "b0.changed" + [2]=> + &unicode(10) "b0.changed" +} +array(3) { + [0]=> + &unicode(10) "b1.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + &unicode(10) "b1.changed" +} +array(3) { + [0]=> + &unicode(10) "b2.changed" + [1]=> + &unicode(10) "b2.changed" + [2]=> + &unicode(10) "b2.changed" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_arrays_003.phpt b/ext/standard/tests/serialize/serialization_arrays_003.phpt new file mode 100644 index 00000000000..4e7e68e408b --- /dev/null +++ b/ext/standard/tests/serialize/serialization_arrays_003.phpt @@ -0,0 +1,516 @@ +--TEST-- +serialization: arrays with references to an external variable +--FILE-- + +--EXPECTF-- + + +--- 0 refs external: +array(3) { + [0]=> + &int(1) + [1]=> + int(1) + [2]=> + int(1) +} +string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}" +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + string(10) "b2.changed" +} + + +--- 1 refs external: +array(3) { + [0]=> + int(1) + [1]=> + &int(1) + [2]=> + int(1) +} +string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}" +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + string(10) "b2.changed" +} + + +--- 2 refs external: +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + &int(1) +} +string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}" +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + string(10) "b2.changed" +} + + +--- 1,2 ref external: +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + int(1) +} +string(30) "a:3:{i:0;i:1;i:1;R:2;i:2;i:1;}" +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + &string(10) "b0.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + &string(10) "b1.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + &string(10) "b1.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + string(10) "b2.changed" +} + + +--- 1,2,3 ref external: +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + &int(1) +} +string(30) "a:3:{i:0;i:1;i:1;R:2;i:2;R:2;}" +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + &int(1) +} +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + &string(10) "b0.changed" + [2]=> + &string(10) "b0.changed" +} +array(3) { + [0]=> + &string(10) "b1.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + &string(10) "b1.changed" +} +array(3) { + [0]=> + &string(10) "b2.changed" + [1]=> + &string(10) "b2.changed" + [2]=> + &string(10) "b2.changed" +} +Done +--UEXPECTF-- + + +--- 0 refs external: +array(3) { + [0]=> + &int(1) + [1]=> + int(1) + [2]=> + int(1) +} +unicode(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}" +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + unicode(10) "b2.changed" +} + + +--- 1 refs external: +array(3) { + [0]=> + int(1) + [1]=> + &int(1) + [2]=> + int(1) +} +unicode(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}" +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + unicode(10) "b2.changed" +} + + +--- 2 refs external: +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + &int(1) +} +unicode(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}" +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + unicode(10) "b2.changed" +} + + +--- 1,2 ref external: +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + int(1) +} +unicode(30) "a:3:{i:0;i:1;i:1;R:2;i:2;i:1;}" +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &unicode(10) "b0.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + &unicode(10) "b1.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + &unicode(10) "b1.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + unicode(10) "b2.changed" +} + + +--- 1,2,3 ref external: +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + &int(1) +} +unicode(30) "a:3:{i:0;i:1;i:1;R:2;i:2;R:2;}" +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + &int(1) +} +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &unicode(10) "b0.changed" + [2]=> + &unicode(10) "b0.changed" +} +array(3) { + [0]=> + &unicode(10) "b1.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + &unicode(10) "b1.changed" +} +array(3) { + [0]=> + &unicode(10) "b2.changed" + [1]=> + &unicode(10) "b2.changed" + [2]=> + &unicode(10) "b2.changed" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_arrays_004.phpt b/ext/standard/tests/serialize/serialization_arrays_004.phpt new file mode 100644 index 00000000000..17af21b7895 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_arrays_004.phpt @@ -0,0 +1,881 @@ +--TEST-- +serialization: arrays with references to the containing array +--FILE-- + +--EXPECTF-- + + +--- 1 refs container: +array(3) { + [0]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + int(1) + [2]=> + int(1) + } + [1]=> + int(1) + [2]=> + int(1) + } + [1]=> + int(1) + [2]=> + int(1) +} +string(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;i:1;i:2;i:1;}i:1;i:1;i:2;i:1;}" +array(3) { + [0]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + int(1) + [2]=> + int(1) + } + [1]=> + int(1) + [2]=> + int(1) + } + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + %string(10) "b0.changed" + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + %string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + %string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + string(10) "b2.changed" +} + + +--- 1,2 ref container: +array(3) { + [0]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [2]=> + int(1) + } + [1]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [2]=> + int(1) + } + [2]=> + int(1) +} +string(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;R:2;i:2;i:1;}i:1;R:2;i:2;i:1;}" +array(3) { + [0]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [2]=> + int(1) + } + [1]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [2]=> + int(1) + } + [2]=> + int(1) +} +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + &string(10) "b0.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + &string(10) "b1.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + &string(10) "b1.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + string(10) "b2.changed" +} + + +--- 1,2,3 ref container: +array(3) { + [0]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } + [1]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } + [2]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } +} +string(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;R:2;i:2;R:2;}i:1;R:2;i:2;R:2;}" +array(3) { + [0]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } + [1]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } + [2]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } +} +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + &string(10) "b0.changed" + [2]=> + &string(10) "b0.changed" +} +array(3) { + [0]=> + &string(10) "b1.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + &string(10) "b1.changed" +} +array(3) { + [0]=> + &string(10) "b2.changed" + [1]=> + &string(10) "b2.changed" + [2]=> + &string(10) "b2.changed" +} +Done +--UEXPECTF-- + + +--- 1 refs container: +array(3) { + [0]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + int(1) + [2]=> + int(1) + } + [1]=> + int(1) + [2]=> + int(1) + } + [1]=> + int(1) + [2]=> + int(1) +} +unicode(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;i:1;i:2;i:1;}i:1;i:1;i:2;i:1;}" +array(3) { + [0]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + int(1) + [2]=> + int(1) + } + [1]=> + int(1) + [2]=> + int(1) + } + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + int(1) + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + unicode(10) "b2.changed" +} + + +--- 1,2 ref container: +array(3) { + [0]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [2]=> + int(1) + } + [1]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [2]=> + int(1) + } + [2]=> + int(1) +} +unicode(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;R:2;i:2;i:1;}i:1;R:2;i:2;i:1;}" +array(3) { + [0]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [2]=> + int(1) + } + [1]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + int(1) + } + [2]=> + int(1) + } + [2]=> + int(1) +} +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &unicode(10) "b0.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + &unicode(10) "b1.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + int(1) +} +array(3) { + [0]=> + &unicode(10) "b1.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + unicode(10) "b2.changed" +} + + +--- 1,2,3 ref container: +array(3) { + [0]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } + [1]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } + [2]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } +} +unicode(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;R:2;i:2;R:2;}i:1;R:2;i:2;R:2;}" +array(3) { + [0]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } + [1]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } + [2]=> + &array(3) { + [0]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [1]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + [2]=> + &array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + *RECURSION* + } + } +} +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &unicode(10) "b0.changed" + [2]=> + &unicode(10) "b0.changed" +} +array(3) { + [0]=> + &unicode(10) "b1.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + &unicode(10) "b1.changed" +} +array(3) { + [0]=> + &unicode(10) "b2.changed" + [1]=> + &unicode(10) "b2.changed" + [2]=> + &unicode(10) "b2.changed" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_arrays_005.phpt b/ext/standard/tests/serialize/serialization_arrays_005.phpt new file mode 100644 index 00000000000..dc8e9a5bff1 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_arrays_005.phpt @@ -0,0 +1,1062 @@ +--TEST-- +serialization: arrays with references, nested +--FILE-- +$v) { + if (is_array($v)){ + foreach($b[$k] as $sk=>$sv) { + $b[$k][$sk] = "b$k.$sk.changed"; + var_dump($b); + } + } else { + $b[$k] = "b$k.changed"; + var_dump($b); + } + } +} + +echo "\n\n--- Nested array references 1 element in containing array:\n"; +$a = array(); +$c = array(1,1,&$a); +$a[0] = &$c[0]; +$a[1] = 1; +check($c); + +echo "\n\n--- Nested array references 1 element in containing array (slightly different):\n"; +$a = array(); +$c = array(1,&$a,1); +$a[0] = 1; +$a[1] = &$c[0]; +check($c); + +echo "\n\n--- Nested array references 2 elements in containing array:\n"; +$a = array(); +$c = array(1,1,&$a); +$a[0] = &$c[0]; +$a[1] = &$c[1]; +check($c); + + +echo "\n\n--- Containing array references 1 element in nested array:\n"; +$a = array(); +$a[0] = 1; +$a[1] = 1; +$c = array(1,&$a[0],&$a); +check($c); + +echo "\n\n--- Containing array references 2 elements in nested array:\n"; +$a = array(); +$a[0] = 1; +$a[1] = 1; +$c = array(&$a[0],&$a[1],&$a); +check($c); + +echo "\n\n--- Nested array references container:\n"; +$a = array(); +$c = array(1,1,&$a); +$a[0] = 1; +$a[1] = &$c; +check($c); + +?> +--EXPECTF-- + + +--- Nested array references 1 element in containing array: +array(3) { + [0]=> + &int(1) + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + &int(1) + [1]=> + int(1) + } +} +string(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:2;i:1;i:1;}}" +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + int(1) + [2]=> + array(2) { + [0]=> + &string(10) "b0.changed" + [1]=> + int(1) + } +} +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &string(10) "b0.changed" + [1]=> + int(1) + } +} +array(3) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + int(1) + } +} +array(3) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + string(12) "b2.1.changed" + } +} + + +--- Nested array references 1 element in containing array (slightly different): +array(3) { + [0]=> + &int(1) + [1]=> + &array(2) { + [0]=> + int(1) + [1]=> + &int(1) + } + [2]=> + int(1) +} +string(48) "a:3:{i:0;i:1;i:1;a:2:{i:0;i:1;i:1;R:2;}i:2;i:1;}" +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + &string(10) "b0.changed" + } + [2]=> + int(1) +} +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + array(2) { + [0]=> + string(12) "b1.0.changed" + [1]=> + &string(10) "b0.changed" + } + [2]=> + int(1) +} +array(3) { + [0]=> + &string(12) "b1.1.changed" + [1]=> + array(2) { + [0]=> + string(12) "b1.0.changed" + [1]=> + &string(12) "b1.1.changed" + } + [2]=> + int(1) +} +array(3) { + [0]=> + &string(12) "b1.1.changed" + [1]=> + array(2) { + [0]=> + string(12) "b1.0.changed" + [1]=> + &string(12) "b1.1.changed" + } + [2]=> + string(10) "b2.changed" +} + + +--- Nested array references 2 elements in containing array: +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + &array(2) { + [0]=> + &int(1) + [1]=> + &int(1) + } +} +string(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:2;i:1;R:3;}}" +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + &int(1) + [2]=> + array(2) { + [0]=> + &string(10) "b0.changed" + [1]=> + &int(1) + } +} +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &string(10) "b0.changed" + [1]=> + &string(10) "b1.changed" + } +} +array(3) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + &string(10) "b1.changed" + } +} +array(3) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + &string(12) "b2.1.changed" + [2]=> + array(2) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + &string(12) "b2.1.changed" + } +} + + +--- Containing array references 1 element in nested array: +array(3) { + [0]=> + int(1) + [1]=> + &int(1) + [2]=> + &array(2) { + [0]=> + &int(1) + [1]=> + int(1) + } +} +string(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:3;i:1;i:1;}}" +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + &int(1) + [2]=> + array(2) { + [0]=> + &int(1) + [1]=> + int(1) + } +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &string(10) "b1.changed" + [1]=> + int(1) + } +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + &string(12) "b2.0.changed" + [2]=> + array(2) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + int(1) + } +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + &string(12) "b2.0.changed" + [2]=> + array(2) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + string(12) "b2.1.changed" + } +} + + +--- Containing array references 2 elements in nested array: +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + &array(2) { + [0]=> + &int(1) + [1]=> + &int(1) + } +} +string(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:2;i:1;R:3;}}" +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + &int(1) + [2]=> + array(2) { + [0]=> + &string(10) "b0.changed" + [1]=> + &int(1) + } +} +array(3) { + [0]=> + &string(10) "b0.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &string(10) "b0.changed" + [1]=> + &string(10) "b1.changed" + } +} +array(3) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + &string(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + &string(10) "b1.changed" + } +} +array(3) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + &string(12) "b2.1.changed" + [2]=> + array(2) { + [0]=> + &string(12) "b2.0.changed" + [1]=> + &string(12) "b2.1.changed" + } +} + + +--- Nested array references container: +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + int(1) + [1]=> + &array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + int(1) + [1]=> + &array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + *RECURSION* + } + } + } + } +} +string(74) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;i:1;i:1;a:3:{i:0;i:1;i:1;i:1;i:2;R:4;}}}" +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + int(1) + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + int(1) + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + *RECURSION* + } + } + } + } +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + &array(2) { + [0]=> + int(1) + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + int(1) + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + *RECURSION* + } + } + } + } +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + &array(2) { + [0]=> + string(12) "b2.0.changed" + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + string(12) "b2.0.changed" + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + *RECURSION* + } + } + } + } +} +array(3) { + [0]=> + string(10) "b0.changed" + [1]=> + string(10) "b1.changed" + [2]=> + &array(2) { + [0]=> + string(12) "b2.0.changed" + [1]=> + string(12) "b2.1.changed" + } +} +--UEXPECTF-- + + +--- Nested array references 1 element in containing array: +array(3) { + [0]=> + &int(1) + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + &int(1) + [1]=> + int(1) + } +} +unicode(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:2;i:1;i:1;}}" +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + int(1) + [2]=> + array(2) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + int(1) + } +} +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + int(1) + } +} +array(3) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + int(1) + } +} +array(3) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + unicode(12) "b2.1.changed" + } +} + + +--- Nested array references 1 element in containing array (slightly different): +array(3) { + [0]=> + &int(1) + [1]=> + &array(2) { + [0]=> + int(1) + [1]=> + &int(1) + } + [2]=> + int(1) +} +unicode(48) "a:3:{i:0;i:1;i:1;a:2:{i:0;i:1;i:1;R:2;}i:2;i:1;}" +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + array(2) { + [0]=> + int(1) + [1]=> + &unicode(10) "b0.changed" + } + [2]=> + int(1) +} +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + array(2) { + [0]=> + unicode(12) "b1.0.changed" + [1]=> + &unicode(10) "b0.changed" + } + [2]=> + int(1) +} +array(3) { + [0]=> + &unicode(12) "b1.1.changed" + [1]=> + array(2) { + [0]=> + unicode(12) "b1.0.changed" + [1]=> + &unicode(12) "b1.1.changed" + } + [2]=> + int(1) +} +array(3) { + [0]=> + &unicode(12) "b1.1.changed" + [1]=> + array(2) { + [0]=> + unicode(12) "b1.0.changed" + [1]=> + &unicode(12) "b1.1.changed" + } + [2]=> + unicode(10) "b2.changed" +} + + +--- Nested array references 2 elements in containing array: +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + &array(2) { + [0]=> + &int(1) + [1]=> + &int(1) + } +} +unicode(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:2;i:1;R:3;}}" +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &int(1) + [2]=> + array(2) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &int(1) + } +} +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &unicode(10) "b1.changed" + } +} +array(3) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + &unicode(10) "b1.changed" + } +} +array(3) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + &unicode(12) "b2.1.changed" + [2]=> + array(2) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + &unicode(12) "b2.1.changed" + } +} + + +--- Containing array references 1 element in nested array: +array(3) { + [0]=> + int(1) + [1]=> + &int(1) + [2]=> + &array(2) { + [0]=> + &int(1) + [1]=> + int(1) + } +} +unicode(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:3;i:1;i:1;}}" +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + &int(1) + [2]=> + array(2) { + [0]=> + &int(1) + [1]=> + int(1) + } +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &unicode(10) "b1.changed" + [1]=> + int(1) + } +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + &unicode(12) "b2.0.changed" + [2]=> + array(2) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + int(1) + } +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + &unicode(12) "b2.0.changed" + [2]=> + array(2) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + unicode(12) "b2.1.changed" + } +} + + +--- Containing array references 2 elements in nested array: +array(3) { + [0]=> + &int(1) + [1]=> + &int(1) + [2]=> + &array(2) { + [0]=> + &int(1) + [1]=> + &int(1) + } +} +unicode(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:2;i:1;R:3;}}" +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &int(1) + [2]=> + array(2) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &int(1) + } +} +array(3) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &unicode(10) "b0.changed" + [1]=> + &unicode(10) "b1.changed" + } +} +array(3) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + &unicode(10) "b1.changed" + [2]=> + array(2) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + &unicode(10) "b1.changed" + } +} +array(3) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + &unicode(12) "b2.1.changed" + [2]=> + array(2) { + [0]=> + &unicode(12) "b2.0.changed" + [1]=> + &unicode(12) "b2.1.changed" + } +} + + +--- Nested array references container: +array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + int(1) + [1]=> + &array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + int(1) + [1]=> + &array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + *RECURSION* + } + } + } + } +} +unicode(74) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;i:1;i:1;a:3:{i:0;i:1;i:1;i:1;i:2;R:4;}}}" +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + int(1) + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + int(1) + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + *RECURSION* + } + } + } + } +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + &array(2) { + [0]=> + int(1) + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + int(1) + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + *RECURSION* + } + } + } + } +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + &array(2) { + [0]=> + unicode(12) "b2.0.changed" + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + &array(2) { + [0]=> + unicode(12) "b2.0.changed" + [1]=> + array(3) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + *RECURSION* + } + } + } + } +} +array(3) { + [0]=> + unicode(10) "b0.changed" + [1]=> + unicode(10) "b1.changed" + [2]=> + &array(2) { + [0]=> + unicode(12) "b2.0.changed" + [1]=> + unicode(12) "b2.1.changed" + } +} diff --git a/ext/standard/tests/serialize/serialization_error_001.phpt b/ext/standard/tests/serialize/serialization_error_001.phpt new file mode 100644 index 00000000000..3f530580d6b --- /dev/null +++ b/ext/standard/tests/serialize/serialization_error_001.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test serialize() & unserialize() functions: error conditions - wrong number of args. +--FILE-- + +--EXPECTF-- +*** Testing serialize()/unserialize() : error conditions *** + +Warning: Wrong parameter count for serialize() in %s on line 16 +NULL + +Warning: unserialize() expects exactly 1 parameter, 0 given in %s on line 17 +bool(false) + +Warning: Wrong parameter count for serialize() in %s on line 20 +NULL + +Warning: unserialize() expects exactly 1 parameter, 2 given in %s on line 21 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_miscTypes_001.phpt b/ext/standard/tests/serialize/serialization_miscTypes_001.phpt new file mode 100644 index 0000000000000000000000000000000000000000..6aadf08c6b9c364758e935c35307a4b0785b9bf5 GIT binary patch literal 13226 zcmeHNZExE~4BprIR~)>cwO6~*yDWKq!3uedN7J z@_CgR$LTg~9#Ttpyn9F<`G}%79G)B;pA3hc6TT?ff){BrPygV(K6}8HS@Zs4nN7X`N%cBEW|IM?j%PZE||C;?+KnPju1nC*iWkEbZ|VxA@o2I@9Uh4KAQ z7$t3JI!T$S%{p6Edfm#CZlFV_cXNMe>2o_;j8W^5k$W zjH;DlzGn@XJzzs;z}&~K_zYM#=?>)bUSD6lnj9VVVdKsosw(z7gB?Hvxes`SF+hEp zmHZtq7I=0r;@Dp3joiQs2Y5R)?yK98F%9=9Z(ScAT9)m&1K50@UGi&|Dgd!vJujuh zL-~=rS=ZIQP|vy^S@NUj>wB>tfIL44C0IT!leqz>1%z_i$J$ou2=ExH`Ufv^#^?M! z;X!b#4m)yjOCV z%!3XlCKz;-=U1$}Eb`^MOFShYtdj8r7+OUlgfq-@mYnCm!M}nb!1#;2=&`*NlGz&L z_cy@R%dG6J=6WCJ9z9}x_7NQ+N$fNO7JCWQFDV8VEAG+)$ptkqJAaqBe9olUMisRFQCYDdYlCd&$^d6hQYDp6;RLmkg-kR4?h$je*7_wt#KOL>d%31{BzYG)BsRn1_9i9@F!}&@n*ez z)Qhn<*4rmf;T!qDhIbnF#;yk(G2qk#t{8CZ0Szw3y?R_$pzC%MSj@FB9g^4%wB>(o z{VW!*7pnXgU-k%I4Q%*0Q5ZOZ1+NKC;6;vWMSf_xw&QCjp{M*Yurn6HUex%6wjYk1 z$nt~8hyNnS4}9DAEhloKU=-pG!T4O9MhM@i+i3g>{*A`R5E0!jT*4bveQm?F9YaBi z6V6zM4P3f#>1q>K4_C_EfRG1^gIL$rxPw3bAs*q#>{~3byCMoVAGZx5Yo51dp0^Bu z#(B#CQ0Fb5iNfh?$L)y`Uj~2_l_#4nN))R^Hh<1>5lQ`5tX6DgQ(uhhV zcvG)($+m3I4XqL84Wv_KIlk*ffgM_w=SH4irIHBk1Vh`eB0GR9TVlQ%-)s&|;JMpJ z=I~RY31)~uTJ^b&o)GR<-d+y`6{KwnlhzDG!c%|8h!lFnGDFxXdOcrI9Evt7Y169&62NCLAcnErKZCD|G^)M}Es1opVo{sh{P`&%3JSLL2z0D&d$20$SN zL=Y*ey04V;#st;kW^mDIArc9y3d1%Rs;4d%caWyKk~Ex2AqGiDfGhVP(gWhw3ru?{ zB%vN+@UqnCS`#c5?9y0bViQPXn|jG35Cm~wY~#W~O?KbHU1ll%82Y(-xD_1c3pO39 zALZK45t|GRQM2>X#$Xj7KAk>C7qW5n2Vf+xTp4=4#A)?&fM3!S@iF_t(zV zNcbeYw|=e$`Oh_Uwc-EXj_#z<(XFrT@#HQY-O2wQT?YRTlB`$OTDt2Ks;8?bREq|? zvHygou2u^vMAzb|+s?bX8VG*e5NvgyZCw%H|KzrAxwI*D$=zXEySrLHe3#U0Ofcv6{oS1cQQmMWi`rYfS}(Nd zc0Jx|C6=ly44o?6;50K=Dsk=Z#cqELZeqJigs?%>D9|^d5Tr5*RnP>d-cj~ zyS;k7D4HjfcCTK6VQ|}iuU@-5GzzDP9|zORBUhiYVq6m zef3Iwhr5@??@j>PI=`y`_tE;@4FZWM@E9ie`;6}9wl%Y~UfXtm^?LEE&?F|efAzZU t`@edJ8oBQ0QY_xS16(1i%%Zn|tCd)gY}o_Wdu&r$wKjooxiNNu{{$&JK0W{d literal 0 HcmV?d00001 diff --git a/ext/standard/tests/serialize/serialization_objects_001.phpt b/ext/standard/tests/serialize/serialization_objects_001.phpt new file mode 100644 index 0000000000000000000000000000000000000000..e10bccab66152deb53c084f62d369430c32572e9 GIT binary patch literal 3680 zcmeHJT~FIE6y-U;;wtM_wT86uV&?wTRNkg=iCXK0b6Ln09K zX(r3%RHKhWT(svDPSHRReb5l*OLl zGnJpf1(S&gW1u=zu$f>n3nf(mh{ky^Sl1KoO~9ie1XMBsBUbF&uYyY7ixS~6@FJfP zU^lWBOB(uA_%-Ze&r^_-fYTVT-2zYCudN}Kawy(VMpM%omYaUavQK}rr*XtqK`>7+ zBp3si&!%KBZxVrd8QQiDYVc}4*-!!ZE<>|z7+yf*7^ZAGVj>3P&Hx-JzrrSo|LEy|J4I>_Y!y(5<$O zxnWeYR)*LqbRcBcx;YC0sv|#{&MYY5@T8Kfc<56}F*M(J2ri__QE8aURPLZSeORvY zXiKF5;7}I>5Nyl@3sI-2Le#UOsfSU)!(qAlcCnjHESJN}-K}7{9MCDgD!jIbA%&Y; z4#sLZs?y zu#+8W+PII~`avQHvn+yBj%`XXIVVorC;B})_ka7Xmg}~h#(t~$p;d1l)ZN2|yWc!$ zVwVlK-c+T_6*#H4N4PnkoB#DR7ZTs_*55{s|7u>(12&Y|;oJw$G`ghhbjfC`(-Hd7 zFMC}Qa`iE^Y<5}L3%K3t0*~6A4q4-OgH3)nSmSqtqTeCt<^8Ty;i-P7N3{5&GRZ3) Y>XTgWZSsq6?DfW{wel}L=hXcE0^@#HHUIzs literal 0 HcmV?d00001 diff --git a/ext/standard/tests/serialize/serialization_objects_002.phpt b/ext/standard/tests/serialize/serialization_objects_002.phpt new file mode 100644 index 0000000000000000000000000000000000000000..32dfff376ca134e49ac70c095477336878c1882a GIT binary patch literal 12462 zcmd^F`)}LG5zf#0D;BJ-mIKM*TN2&mkj6<-AV>}uyC~os3`(Lbwu)p()a7CLfA6<5 zyGt%bIZhn8F9C|knSIR8WJ#b!}`pKcc8 zB3~}niCB*Qk&TPB==`2yJP{9Dz22+8zJ7_7{`B+J>`JtrJQlyKmc_F8e3c22h%5Ob z*2OAcTvj&vkblZ1f)*Ohv%{8nEKaiZc$HttbrbPxR%}*_wMg~URd%(?*4d(!mw8&OslvNKgITUjFcgxLcoQd&rk|iShR6JQ1>0*+uCQl&6(O3?7 zKF`y&fVh=IgZ^a4q4*3{b*W?OV_n!nZ=dos{bzQ!GeT6c%Eqe<2V9H1xc8A-*?6`T z&ih5L*AvnUq<#Ko3@h@5u{TD%UpU9D)_9(-*WyF=VU(@bqIKO8FmL`lL=tVB`9i-u z6`p%c%w++OfuR*!zdjWXs|u@Pjm>DDkJT7{ek#({D*fE)d9Hip`9arA=!(-{&t4uL zw{EmNi=~$6S{ULBA*F**qMdd{dxY;8-wD1MzEgZJ@tw*2wY9~?#TbrWtTy8Uksuck zqFv1Lb?;d!^q~xC1XA@FhA{?13Mtn%#0iK!|0oFYu^1T`d|0n5{3GA5pS7#lhg}%G z>9fc_YNK>8Xt9~kp`Xg$Q*0pz8BKL;{w4VBzr23?=jX5AogYl|d3G^_!_BjU->h|J z829Gv^=nDIDGhKU!zo)#)`GR(s87-U2z`IT_cOjJg#d@57NJCzD~r>D;ZAyiunkX=mDLSlg-U<+PMP)tb}oNPW^foz8G9LcV2 zc4jhdZM#ZN(HmAs&1*}r(_2>to6P}@8uCw;iwx)b`5ChJ%fJ8f^2O;ZB=9>Wf>!Iz zvdG6sp=XOpHq93R_Z&~35>at1nLU15izN~=Mu;G6nnsa|$IkI6@%VY-98VIB>Tdbz55r&( z_xppWKkN^E*XhfYeoO9#W~X(pd;9OV)XamO*- zd2#rMpC+O+;Ouk`clhn;Gem8^C_0`i@$cLjDVp-57+%DW4zb6IJz6g39hnh$)^PIzl%1{|&nKw} zhml5~a#Ljp<(aHP62>T4zU|x=%Nc#kfi;!N0!fmU24gLl%$8tC^0_lrc2{aOF3gHm zR^XwRYN(oj?#!x$o3CJ<=fa~I>rU!e#{mMUWBdRH0^tB1_%I6~2Lz!H698H&tPp(a z>Dxo?S+F=qDdNH*^QU^FagzbO)gy#c|m8qA(r|20`S7p&RUmBW5#5ESk^pKRiKm#HII+1z?~SibvO(o&y6ED4#IvMp~RyEBLjx( zQd#hZw)ME8gQ3$Tj;Z$=J&(oH zzRTi;+v43?wV2As2(D5tb~klXNiw1;fh6?G;9^m9oUkZ}JT5p(P1R(?9+gtBqDC-` zJY0k-C03qAN@S<-!ntmp11I8+%1&{R(ZmlPN!Py$UKDRkYh zx0~`x`?w)!ud3O33kxN@K4N&?w@!myI{hEGDQgUG!cpSEO_aj`In~pCedE?U_SlGWW}>*F3snB21VgipDLb~Z@uddTC4A^`xfNO&X>=f& z$kHHb2=|YhmTVNFFL?I<*CgC5a`~6S?JnV2wM$4Zz}&NHmyn2vD_QE$Ga~D|yM(j= z0`iA;2`zE&*d;vsT9*)#Hg*ZE%`oW4cL}W>wz`C*!5v*f;!*2@p1!k7xM^w=ZcLw0 zyHc%DxG}v93l7dV=31c8M*Y!{?ra-JM>XTr{dn%>94g5^~~G)g}crL3DtBP_jPesL4FLal#zGs81CK}>zUG5s;Z{gYBhTT8Cwz>3mwMzNFk&!CU=9QVJBz{X=?# zitpV&q=jIg@9!Vd3Y5rn|Bxtqwkac^ZXlMBs_D9eSXx(CXr_f&T9{eY9^%6od8?5~ znuC!|fdCVmXDS?AQ#i;*;zMZK!XhA~j-WbSmz_j6Erm+b+G6O0RYpy{3I79ts@_r5 zDz<*9P~(mw(V=RqbRZ&pe4DsuH#c}|dWxk1nt0j>nzvP1=)1tq0S{r6t@ffe2Djbl z4JO%Zd(krGjkdaJ3^rYh>+Que)n3%z@$KzJnz?5evT8B9A(k%0ynj!FvDpKafZC5) zz=vuvYLToSW0@vcnE&7=<3nYwTBnh`7+LEL=OaX}dLkI5PNNPH`bDSlAsoL`MB z6zyMii&xT>W|jTMhf(iV(^0E;tLgaPck!m9z(1PMm3Z(N>S@pTczf4TUnuGS zGCRrctEkm?)U$S9L$!C=33}HRl#!=$0j*v?bz!@^^|)&@``T$0bbRHkrHijOAIoyP Qj5S?yl$0M*V^9n7U(~bk!Ta = 10; + $this->b = 12.222; + $this->c = "string"; + } + abstract protected function getClassName(); + public function printClassName () { + return $this->getClassName(); + } +} +// implement abstract class +class extendName extends Name +{ + var $a, $b, $c; + + protected function getClassName() { + return "extendName"; + } +} + +$obj_extendName = new extendName(); +$serialize_data = serialize($obj_extendName); +var_dump( $serialize_data ); +$unserialize_data = unserialize($serialize_data); +var_dump( $unserialize_data ); + +$serialize_data = serialize($obj_extendName->printClassName()); +var_dump( $serialize_data ); +$unserialize_data = unserialize($serialize_data); +var_dump( $unserialize_data ); + +echo "\nDone"; +?> +--EXPECTF-- +--- Testing Abstract Class --- +string(119) "O:10:"extendName":3:{S:1:"a";i:10;S:1:"b";d:12.2219999999999995310417943983338773250579833984375;S:1:"c";S:6:"string";}" +object(extendName)#%d (3) { + ["a"]=> + int(10) + ["b"]=> + float(12.222) + ["c"]=> + string(6) "string" +} +string(18) "S:10:"extendName";" +string(10) "extendName" + +Done +--UEXPECTF-- +--- Testing Abstract Class --- +unicode(119) "O:10:"extendName":3:{U:1:"a";i:10;U:1:"b";d:12.2219999999999995310417943983338773250579833984375;U:1:"c";U:6:"string";}" +object(extendName)#%d (3) { + [u"a"]=> + int(10) + [u"b"]=> + float(12.222) + [u"c"]=> + unicode(6) "string" +} +unicode(18) "U:10:"extendName";" +unicode(10) "extendName" + +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_objects_004.phpt b/ext/standard/tests/serialize/serialization_objects_004.phpt new file mode 100644 index 00000000000..c752c45e357 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_004.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test serialize() & unserialize() functions: objects - ensure that COW references of objects are not serialized separately (unlike other types). +--FILE-- + +--EXPECTF-- +string(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;r:2;}" +string(22) "a:2:{i:0;i:1;i:1;i:1;}" +string(30) "a:2:{i:0;S:1:"a";i:1;S:1:"a";}" +string(22) "a:2:{i:0;b:1;i:1;b:1;}" +string(18) "a:2:{i:0;N;i:1;N;}" +string(26) "a:2:{i:0;a:0:{}i:1;a:0:{}}" +Done +--UEXPECTF-- +unicode(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;r:2;}" +unicode(22) "a:2:{i:0;i:1;i:1;i:1;}" +unicode(30) "a:2:{i:0;U:1:"a";i:1;U:1:"a";}" +unicode(22) "a:2:{i:0;b:1;i:1;b:1;}" +unicode(18) "a:2:{i:0;N;i:1;N;}" +unicode(26) "a:2:{i:0;a:0:{}i:1;a:0:{}}" +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_objects_005.phpt b/ext/standard/tests/serialize/serialization_objects_005.phpt new file mode 100644 index 00000000000..c89c8e3132c --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_005.phpt @@ -0,0 +1,175 @@ +--TEST-- +Check behaviour of incomplete class +--FILE-- + Various types of access on complete class:\n" ; +var_dump($complete); +var_dump(is_object($complete)); +var_dump($complete->p); + +$ref1 = "ref1.original"; +$complete->p = &$ref1; +var_dump($complete->p); +$ref1 = "ref1.changed"; +var_dump($complete->p); +$complete->p = "p.changed"; +var_dump($ref1); + +var_dump(isset($complete->x)); +$complete->x = "x.new"; +var_dump(isset($complete->x)); +unset($complete->x); +var_dump($complete->x); + + +echo "\n\n---> Same types of access on incomplete class:\n" ; +var_dump($incomplete); +var_dump(is_object($incomplete)); +var_dump($incomplete->p); + +$ref2 = "ref1.original"; +$incomplete->p = &$ref2; +var_dump($incomplete->p); +$ref2 = "ref1.changed"; +var_dump($incomplete->p); +$incomplete->p = "p.changed"; +var_dump($ref1); + +var_dump(isset($incomplete->x)); +$incomplete->x = "x.new"; +var_dump(isset($incomplete->x)); +unset($incomplete->x); +var_dump($incomplete->x); + +$incomplete->f(); + +echo "Done"; +?> +--EXPECTF-- +---> Various types of access on complete class: +object(C)#%d (1) { + ["p"]=> + int(1) +} +bool(true) +int(1) +string(13) "ref1.original" +string(12) "ref1.changed" +string(9) "p.changed" +bool(false) +bool(true) + +Notice: Undefined property: C::$x in %s on line 37 +NULL + + +---> Same types of access on incomplete class: +object(__PHP_Incomplete_Class)#%d (2) { + ["__PHP_Incomplete_Class_Name"]=> + string(1) "C" + ["p"]=> + int(1) +} +bool(false) + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 43 +NULL + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 46 + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 47 +NULL + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 49 +NULL + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 50 +string(9) "p.changed" + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 53 +bool(false) + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 54 + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 55 +bool(false) + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 56 + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 57 +NULL + +Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 59 +--UEXPECTF-- +---> Various types of access on complete class: +object(C)#%d (1) { + [u"p"]=> + int(1) +} +bool(true) +int(1) +unicode(13) "ref1.original" +unicode(12) "ref1.changed" +unicode(9) "p.changed" +bool(false) +bool(true) + +Notice: Undefined property: C::$x in %s on line 37 +NULL + + +---> Same types of access on incomplete class: +object(__PHP_Incomplete_Class)#%d (2) { + [u"__PHP_Incomplete_Class_Name"]=> + unicode(1) "C" + [u"p"]=> + int(1) +} +bool(false) + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 43 +NULL + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 46 + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 47 +NULL + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 49 +NULL + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 50 +unicode(9) "p.changed" + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 53 +bool(false) + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 54 + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 55 +bool(false) + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 56 + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 57 +NULL + +Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 59 \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_objects_006.phpt b/ext/standard/tests/serialize/serialization_objects_006.phpt new file mode 100644 index 00000000000..e223f4ee12b --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_006.phpt @@ -0,0 +1,28 @@ +--TEST-- +Behaviour of incomplete class is preserved even when it was not created by unserialize(). +--FILE-- +p); + +echo "Done"; +?> +--EXPECTF-- +object(__PHP_Incomplete_Class)#%d (0) { +} + +Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 15 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_objects_007.phpt b/ext/standard/tests/serialize/serialization_objects_007.phpt new file mode 100644 index 00000000000..975f812eda0 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_007.phpt @@ -0,0 +1,53 @@ +--TEST-- +Ensure __autoload is called twice if unserialize_callback_func is defined. +--FILE-- + +--EXPECTF-- +in __autoload(FOO) +in check(FOO) +in __autoload(FOO) + +Warning: unserialize(): Function check() hasn't defined the class it was called for in %s on line 23 +object(__PHP_Incomplete_Class)#%d (1) { + ["__PHP_Incomplete_Class_Name"]=> + string(3) "FOO" +} +Done +--UEXPECTF-- +in __autoload(FOO) +in check(FOO) +in __autoload(FOO) + +Warning: unserialize(): Function check() hasn't defined the class it was called for in %s on line 23 +object(__PHP_Incomplete_Class)#%d (1) { + [u"__PHP_Incomplete_Class_Name"]=> + unicode(3) "FOO" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_objects_008.phpt b/ext/standard/tests/serialize/serialization_objects_008.phpt new file mode 100644 index 00000000000..3557013e96d --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_008.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bad unserialize_callback_func +--FILE-- + +--EXPECTF-- + +Warning: unserialize(): defined (Nonexistent) but not found in %s on line 14 +object(__PHP_Incomplete_Class)#%d (1) { + ["__PHP_Incomplete_Class_Name"]=> + string(3) "FOO" +} +Done +--UEXPECTF-- + +Warning: unserialize(): defined (Nonexistent) but not found in %s on line 14 +object(__PHP_Incomplete_Class)#%d (1) { + [u"__PHP_Incomplete_Class_Name"]=> + unicode(3) "FOO" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_objects_009.phpt b/ext/standard/tests/serialize/serialization_objects_009.phpt new file mode 100644 index 00000000000..2e8b2dc80f0 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_009.phpt @@ -0,0 +1,36 @@ +--TEST-- +Custom unserialization of classes with no custom unserializer. +--FILE-- + +--EXPECTF-- + +Warning: Class __PHP_Incomplete_Class has no unserializer in %s on line 14 + +Notice: unserialize(): Error at offset 6 of 18 bytes in %s on line 14 + +Warning: Class C has no unserializer in %s on line 16 + +Notice: unserialize(): Error at offset 6 of 18 bytes in %s on line 16 +bool(false) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_objects_010.phpt b/ext/standard/tests/serialize/serialization_objects_010.phpt new file mode 100644 index 00000000000..0fbf0723df2 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_010.phpt @@ -0,0 +1,37 @@ +--TEST-- +Serialize() must return a string or NULL +--SKIPIF-- + +--FILE-- +getMessage(). "\n"; +} + +echo "Done"; +?> +--EXPECTF-- +C::serialize() must return a string or NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_objects_011.phpt b/ext/standard/tests/serialize/serialization_objects_011.phpt new file mode 100644 index 00000000000..6e86dc95fb0 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_011.phpt @@ -0,0 +1,314 @@ +--TEST-- +Object serialization / unserialization with inherited and hidden properties. +--FILE-- +APriv, $this->AProt, $this->APub); + } +} + +Class B extends A { + private $BPriv = "B.BPriv"; + protected $BProt = "B.BProt"; + public $BPub = "B.BPub"; + + function audit() { + return parent::audit() && isset($this->AProt, $this->APub, + $this->BPriv, $this->BProt, $this->BPub); + } +} + +Class C extends B { + private $APriv = "C.APriv"; + protected $AProt = "C.AProt"; + public $APub = "C.APub"; + + private $CPriv = "C.CPriv"; + protected $CProt = "C.BProt"; + public $CPub = "C.CPub"; + + function audit() { + return parent::audit() && isset($this->APriv, $this->AProt, $this->APub, + $this->BProt, $this->BPub, + $this->CPriv, $this->CProt, $this->CPub); + } +} + +function prettyPrint($obj) { + echo "\n\nBefore serialization:\n"; + var_dump($obj); + + echo "Serialized form:\n"; + $ser = serialize($obj); + $serPrintable = str_replace("\0", '\0', $ser); + var_dump($serPrintable); + + echo "Unserialized:\n"; + $uobj = unserialize($ser); + var_dump($uobj); + + echo "Sanity check: "; + var_dump($uobj->audit()); +} + +echo "-- Test instance of A --\n"; +prettyPrint(new A); +echo "\n\n-- Test instance of B --\n"; +prettyPrint(new B); +echo "\n\n-- Test instance of C --\n"; +prettyPrint(new C); + +echo "Done"; +?> +--EXPECTF-- +-- Test instance of A -- + + +Before serialization: +object(A)#%d (3) { + ["APriv":"A":private]=> + string(7) "A.APriv" + ["AProt":protected]=> + string(7) "A.AProt" + ["APub"]=> + string(6) "A.APub" +} +Serialized form: +string(98) "O:1:"A":3:{S:8:"\0A\0APriv";S:7:"A.APriv";S:8:"\0*\0AProt";S:7:"A.AProt";S:4:"APub";S:6:"A.APub";}" +Unserialized: +object(A)#%d (3) { + ["APriv":"A":private]=> + string(7) "A.APriv" + ["AProt":protected]=> + string(7) "A.AProt" + ["APub"]=> + string(6) "A.APub" +} +Sanity check: bool(true) + + +-- Test instance of B -- + + +Before serialization: +object(B)#%d (6) { + ["BPriv":"B":private]=> + string(7) "B.BPriv" + ["BProt":protected]=> + string(7) "B.BProt" + ["BPub"]=> + string(6) "B.BPub" + ["APriv":"A":private]=> + string(7) "A.APriv" + ["AProt":protected]=> + string(7) "A.AProt" + ["APub"]=> + string(6) "A.APub" +} +Serialized form: +string(184) "O:1:"B":6:{S:8:"\0B\0BPriv";S:7:"B.BPriv";S:8:"\0*\0BProt";S:7:"B.BProt";S:4:"BPub";S:6:"B.BPub";S:8:"\0A\0APriv";S:7:"A.APriv";S:8:"\0*\0AProt";S:7:"A.AProt";S:4:"APub";S:6:"A.APub";}" +Unserialized: +object(B)#%d (6) { + ["BPriv":"B":private]=> + string(7) "B.BPriv" + ["BProt":protected]=> + string(7) "B.BProt" + ["BPub"]=> + string(6) "B.BPub" + ["APriv":"A":private]=> + string(7) "A.APriv" + ["AProt":protected]=> + string(7) "A.AProt" + ["APub"]=> + string(6) "A.APub" +} +Sanity check: bool(true) + + +-- Test instance of C -- + + +Before serialization: +object(C)#%d (10) { + ["APriv":"C":private]=> + string(7) "C.APriv" + ["AProt":protected]=> + string(7) "C.AProt" + ["APub"]=> + string(6) "C.APub" + ["CPriv":"C":private]=> + string(7) "C.CPriv" + ["CProt":protected]=> + string(7) "C.BProt" + ["CPub"]=> + string(6) "C.CPub" + ["BPriv":"B":private]=> + string(7) "B.BPriv" + ["BProt":protected]=> + string(7) "B.BProt" + ["BPub"]=> + string(6) "B.BPub" + ["APriv":"A":private]=> + string(7) "A.APriv" +} +Serialized form: +string(302) "O:1:"C":10:{S:8:"\0C\0APriv";S:7:"C.APriv";S:8:"\0*\0AProt";S:7:"C.AProt";S:4:"APub";S:6:"C.APub";S:8:"\0C\0CPriv";S:7:"C.CPriv";S:8:"\0*\0CProt";S:7:"C.BProt";S:4:"CPub";S:6:"C.CPub";S:8:"\0B\0BPriv";S:7:"B.BPriv";S:8:"\0*\0BProt";S:7:"B.BProt";S:4:"BPub";S:6:"B.BPub";S:8:"\0A\0APriv";S:7:"A.APriv";}" +Unserialized: +object(C)#%d (10) { + ["APriv":"C":private]=> + string(7) "C.APriv" + ["AProt":protected]=> + string(7) "C.AProt" + ["APub"]=> + string(6) "C.APub" + ["CPriv":"C":private]=> + string(7) "C.CPriv" + ["CProt":protected]=> + string(7) "C.BProt" + ["CPub"]=> + string(6) "C.CPub" + ["BPriv":"B":private]=> + string(7) "B.BPriv" + ["BProt":protected]=> + string(7) "B.BProt" + ["BPub"]=> + string(6) "B.BPub" + ["APriv":"A":private]=> + string(7) "A.APriv" +} +Sanity check: bool(true) +Done +--UEXPECTF-- +-- Test instance of A -- + + +Before serialization: +object(A)#%d (3) { + [u"APriv":u"A":private]=> + unicode(7) "A.APriv" + [u"AProt":protected]=> + unicode(7) "A.AProt" + [u"APub"]=> + unicode(6) "A.APub" +} +Serialized form: +unicode(98) "O:1:"A":3:{U:8:"\0A\0APriv";U:7:"A.APriv";U:8:"\0*\0AProt";U:7:"A.AProt";U:4:"APub";U:6:"A.APub";}" +Unserialized: +object(A)#%d (3) { + [u"APriv":u"A":private]=> + unicode(7) "A.APriv" + [u"AProt":protected]=> + unicode(7) "A.AProt" + [u"APub"]=> + unicode(6) "A.APub" +} +Sanity check: bool(true) + + +-- Test instance of B -- + + +Before serialization: +object(B)#%d (6) { + [u"BPriv":u"B":private]=> + unicode(7) "B.BPriv" + [u"BProt":protected]=> + unicode(7) "B.BProt" + [u"BPub"]=> + unicode(6) "B.BPub" + [u"APriv":u"A":private]=> + unicode(7) "A.APriv" + [u"AProt":protected]=> + unicode(7) "A.AProt" + [u"APub"]=> + unicode(6) "A.APub" +} +Serialized form: +unicode(184) "O:1:"B":6:{U:8:"\0B\0BPriv";U:7:"B.BPriv";U:8:"\0*\0BProt";U:7:"B.BProt";U:4:"BPub";U:6:"B.BPub";U:8:"\0A\0APriv";U:7:"A.APriv";U:8:"\0*\0AProt";U:7:"A.AProt";U:4:"APub";U:6:"A.APub";}" +Unserialized: +object(B)#%d (6) { + [u"BPriv":u"B":private]=> + unicode(7) "B.BPriv" + [u"BProt":protected]=> + unicode(7) "B.BProt" + [u"BPub"]=> + unicode(6) "B.BPub" + [u"APriv":u"A":private]=> + unicode(7) "A.APriv" + [u"AProt":protected]=> + unicode(7) "A.AProt" + [u"APub"]=> + unicode(6) "A.APub" +} +Sanity check: bool(true) + + +-- Test instance of C -- + + +Before serialization: +object(C)#%d (10) { + [u"APriv":u"C":private]=> + unicode(7) "C.APriv" + [u"AProt":protected]=> + unicode(7) "C.AProt" + [u"APub"]=> + unicode(6) "C.APub" + [u"CPriv":u"C":private]=> + unicode(7) "C.CPriv" + [u"CProt":protected]=> + unicode(7) "C.BProt" + [u"CPub"]=> + unicode(6) "C.CPub" + [u"BPriv":u"B":private]=> + unicode(7) "B.BPriv" + [u"BProt":protected]=> + unicode(7) "B.BProt" + [u"BPub"]=> + unicode(6) "B.BPub" + [u"APriv":u"A":private]=> + unicode(7) "A.APriv" +} +Serialized form: +unicode(302) "O:1:"C":10:{U:8:"\0C\0APriv";U:7:"C.APriv";U:8:"\0*\0AProt";U:7:"C.AProt";U:4:"APub";U:6:"C.APub";U:8:"\0C\0CPriv";U:7:"C.CPriv";U:8:"\0*\0CProt";U:7:"C.BProt";U:4:"CPub";U:6:"C.CPub";U:8:"\0B\0BPriv";U:7:"B.BPriv";U:8:"\0*\0BProt";U:7:"B.BProt";U:4:"BPub";U:6:"B.BPub";U:8:"\0A\0APriv";U:7:"A.APriv";}" +Unserialized: +object(C)#%d (10) { + [u"APriv":u"C":private]=> + unicode(7) "C.APriv" + [u"AProt":protected]=> + unicode(7) "C.AProt" + [u"APub"]=> + unicode(6) "C.APub" + [u"CPriv":u"C":private]=> + unicode(7) "C.CPriv" + [u"CProt":protected]=> + unicode(7) "C.BProt" + [u"CPub"]=> + unicode(6) "C.CPub" + [u"BPriv":u"B":private]=> + unicode(7) "B.BPriv" + [u"BProt":protected]=> + unicode(7) "B.BProt" + [u"BPub"]=> + unicode(6) "B.BPub" + [u"APriv":u"A":private]=> + unicode(7) "A.APriv" +} +Sanity check: bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_objects_012.phpt b/ext/standard/tests/serialize/serialization_objects_012.phpt new file mode 100644 index 00000000000..7f3a7ef5b50 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_012.phpt @@ -0,0 +1,402 @@ +--TEST-- +Object serialization / unserialization: real references and COW references +--FILE-- +a = "newProp"; +var_dump($ua); +$ua[0] = "a0.changed"; +var_dump($ua); + + +echo "\n\nArray containing object and reference to that object:\n"; +$obj = new stdclass; +$a[0] = $obj; +$a[1] = &$a[0]; +var_dump($a); + +$ser = serialize($a); +var_dump($ser); + +$ua = unserialize($ser); +var_dump($ua); +$ua[0]->a = "newProp"; +var_dump($ua); +$ua[0] = "a0.changed"; +var_dump($ua); + +echo "\n\nObject containing same object twice:"; +$obj = new stdclass; +$contaner = new stdclass; +$contaner->a = $obj; +$contaner->b = $contaner->a; +var_dump($contaner); + +$ser = serialize($contaner); +var_dump($ser); + +$ucontainer = unserialize($ser); +var_dump($ucontainer); +$ucontainer->a->a = "newProp"; +var_dump($ucontainer); +$ucontainer->a = "container->a.changed"; +var_dump($ucontainer); + + +echo "\n\nObject containing object and reference to that object:\n"; +$obj = new stdclass; +$contaner = new stdclass; +$contaner->a = $obj; +$contaner->b = &$contaner->a; +var_dump($contaner); + +$ser = serialize($contaner); +var_dump($ser); + +$ucontainer = unserialize($ser); +var_dump($ucontainer); +$ucontainer->a->a = "newProp"; +var_dump($ucontainer); +$ucontainer->b = "container->a.changed"; +var_dump($ucontainer); + +echo "Done"; +?> +--EXPECTF-- + + +Array containing same object twice: +array(2) { + [0]=> + object(stdClass)#%d (0) { + } + [1]=> + object(stdClass)#%d (0) { + } +} +string(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;r:2;}" +array(2) { + [0]=> + object(stdClass)#%d (0) { + } + [1]=> + object(stdClass)#%d (0) { + } +} +array(2) { + [0]=> + object(stdClass)#%d (1) { + ["a"]=> + string(7) "newProp" + } + [1]=> + object(stdClass)#%d (1) { + ["a"]=> + string(7) "newProp" + } +} +array(2) { + [0]=> + string(10) "a0.changed" + [1]=> + object(stdClass)#%d (1) { + ["a"]=> + string(7) "newProp" + } +} + + +Array containing object and reference to that object: +array(2) { + [0]=> + &object(stdClass)#%d (0) { + } + [1]=> + &object(stdClass)#%d (0) { + } +} +string(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;R:2;}" +array(2) { + [0]=> + &object(stdClass)#%d (0) { + } + [1]=> + &object(stdClass)#%d (0) { + } +} +array(2) { + [0]=> + &object(stdClass)#%d (1) { + ["a"]=> + string(7) "newProp" + } + [1]=> + &object(stdClass)#%d (1) { + ["a"]=> + string(7) "newProp" + } +} +array(2) { + [0]=> + &string(10) "a0.changed" + [1]=> + &string(10) "a0.changed" +} + + +Object containing same object twice:object(stdClass)#%d (2) { + ["a"]=> + object(stdClass)#%d (0) { + } + ["b"]=> + object(stdClass)#%d (0) { + } +} +string(58) "O:8:"stdClass":2:{S:1:"a";O:8:"stdClass":0:{}S:1:"b";r:2;}" +object(stdClass)#%d (2) { + ["a"]=> + object(stdClass)#%d (0) { + } + ["b"]=> + object(stdClass)#%d (0) { + } +} +object(stdClass)#%d (2) { + ["a"]=> + object(stdClass)#%d (1) { + ["a"]=> + string(7) "newProp" + } + ["b"]=> + object(stdClass)#%d (1) { + ["a"]=> + string(7) "newProp" + } +} +object(stdClass)#%d (2) { + ["a"]=> + string(20) "container->a.changed" + ["b"]=> + object(stdClass)#%d (1) { + ["a"]=> + string(7) "newProp" + } +} + + +Object containing object and reference to that object: +object(stdClass)#%d (2) { + ["a"]=> + &object(stdClass)#%d (0) { + } + ["b"]=> + &object(stdClass)#%d (0) { + } +} +string(58) "O:8:"stdClass":2:{S:1:"a";O:8:"stdClass":0:{}S:1:"b";R:2;}" +object(stdClass)#%d (2) { + ["a"]=> + &object(stdClass)#%d (0) { + } + ["b"]=> + &object(stdClass)#%d (0) { + } +} +object(stdClass)#%d (2) { + ["a"]=> + &object(stdClass)#%d (1) { + ["a"]=> + string(7) "newProp" + } + ["b"]=> + &object(stdClass)#%d (1) { + ["a"]=> + string(7) "newProp" + } +} +object(stdClass)#%d (2) { + ["a"]=> + &string(20) "container->a.changed" + ["b"]=> + &string(20) "container->a.changed" +} +Done +--UEXPECTF-- + +Array containing same object twice: +array(2) { + [0]=> + object(stdClass)#%d (0) { + } + [1]=> + object(stdClass)#%d (0) { + } +} +unicode(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;r:2;}" +array(2) { + [0]=> + object(stdClass)#%d (0) { + } + [1]=> + object(stdClass)#%d (0) { + } +} +array(2) { + [0]=> + object(stdClass)#%d (1) { + [u"a"]=> + unicode(7) "newProp" + } + [1]=> + object(stdClass)#%d (1) { + [u"a"]=> + unicode(7) "newProp" + } +} +array(2) { + [0]=> + unicode(10) "a0.changed" + [1]=> + object(stdClass)#%d (1) { + [u"a"]=> + unicode(7) "newProp" + } +} + + +Array containing object and reference to that object: +array(2) { + [0]=> + &object(stdClass)#%d (0) { + } + [1]=> + &object(stdClass)#%d (0) { + } +} +unicode(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;R:2;}" +array(2) { + [0]=> + &object(stdClass)#%d (0) { + } + [1]=> + &object(stdClass)#%d (0) { + } +} +array(2) { + [0]=> + &object(stdClass)#%d (1) { + [u"a"]=> + unicode(7) "newProp" + } + [1]=> + &object(stdClass)#%d (1) { + [u"a"]=> + unicode(7) "newProp" + } +} +array(2) { + [0]=> + &unicode(10) "a0.changed" + [1]=> + &unicode(10) "a0.changed" +} + + +Object containing same object twice:object(stdClass)#%d (2) { + [u"a"]=> + object(stdClass)#%d (0) { + } + [u"b"]=> + object(stdClass)#%d (0) { + } +} +unicode(58) "O:8:"stdClass":2:{U:1:"a";O:8:"stdClass":0:{}U:1:"b";r:2;}" +object(stdClass)#%d (2) { + [u"a"]=> + object(stdClass)#%d (0) { + } + [u"b"]=> + object(stdClass)#%d (0) { + } +} +object(stdClass)#%d (2) { + [u"a"]=> + object(stdClass)#%d (1) { + [u"a"]=> + unicode(7) "newProp" + } + [u"b"]=> + object(stdClass)#%d (1) { + [u"a"]=> + unicode(7) "newProp" + } +} +object(stdClass)#%d (2) { + [u"a"]=> + unicode(20) "container->a.changed" + [u"b"]=> + object(stdClass)#%d (1) { + [u"a"]=> + unicode(7) "newProp" + } +} + + +Object containing object and reference to that object: +object(stdClass)#%d (2) { + [u"a"]=> + &object(stdClass)#%d (0) { + } + [u"b"]=> + &object(stdClass)#%d (0) { + } +} +unicode(58) "O:8:"stdClass":2:{U:1:"a";O:8:"stdClass":0:{}U:1:"b";R:2;}" +object(stdClass)#%d (2) { + [u"a"]=> + &object(stdClass)#%d (0) { + } + [u"b"]=> + &object(stdClass)#%d (0) { + } +} +object(stdClass)#%d (2) { + [u"a"]=> + &object(stdClass)#%d (1) { + [u"a"]=> + unicode(7) "newProp" + } + [u"b"]=> + &object(stdClass)#%d (1) { + [u"a"]=> + unicode(7) "newProp" + } +} +object(stdClass)#%d (2) { + [u"a"]=> + &unicode(20) "container->a.changed" + [u"b"]=> + &unicode(20) "container->a.changed" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_objects_013.phpt b/ext/standard/tests/serialize/serialization_objects_013.phpt new file mode 100644 index 00000000000..7e4d58a6ddf --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_013.phpt @@ -0,0 +1,890 @@ +--TEST-- +Object serialization / unserialization: references amongst properties +--INI-- +error_reporting = E_ALL & ~E_STRICT +--FILE-- +a = "obj->a.changed"; + var_dump($uobj); + $uobj->b = "obj->b.changed"; + var_dump($uobj); + $uobj->c = "obj->c.changed"; + var_dump($uobj); +} + +echo "\n\n--- a refs b:\n"; +$obj = new stdClass; +$obj->a = &$obj->b; +$obj->b = 1; +$obj->c = 1; +check($obj); + +echo "\n\n--- a refs c:\n"; +$obj = new stdClass; +$obj->a = &$obj->c; +$obj->b = 1; +$obj->c = 1; +check($obj); + +echo "\n\n--- b refs a:\n"; +$obj = new stdClass; +$obj->a = 1; +$obj->b = &$obj->a; +$obj->c = 1; +check($obj); + +echo "\n\n--- b refs c:\n"; +$obj = new stdClass; +$obj->a = 1; +$obj->b = &$obj->c; +$obj->c = 1; +check($obj); + +echo "\n\n--- c refs a:\n"; +$obj = new stdClass; +$obj->a = 1; +$obj->b = 1; +$obj->c = &$obj->a; +check($obj); + +echo "\n\n--- c refs b:\n"; +$obj = new stdClass; +$obj->a = 1; +$obj->b = 1; +$obj->c = &$obj->b; +check($obj); + +echo "\n\n--- a,b refs c:\n"; +$obj = new stdClass; +$obj->a = &$obj->c; +$obj->b = &$obj->c; +$obj->c = 1; +check($obj); + +echo "\n\n--- a,c refs b:\n"; +$obj = new stdClass; +$obj->a = &$obj->b; +$obj->b = 1; +$obj->c = &$obj->b; +check($obj); + +echo "\n\n--- b,c refs a:\n"; +$obj = new stdClass; +$obj->a = 1; +$obj->b = &$obj->a; +$obj->c = &$obj->a; +check($obj); + +echo "Done"; +?> +--EXPECTF-- + +--- a refs b: +object(stdClass)#%d (3) { + ["b"]=> + &int(1) + ["a"]=> + &int(1) + ["c"]=> + int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"b";i:1;S:1:"a";R:2;S:1:"c";i:1;}" +object(stdClass)#%d (3) { + ["b"]=> + &int(1) + ["a"]=> + &int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["b"]=> + &string(14) "obj->a.changed" + ["a"]=> + &string(14) "obj->a.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["b"]=> + &string(14) "obj->b.changed" + ["a"]=> + &string(14) "obj->b.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["b"]=> + &string(14) "obj->b.changed" + ["a"]=> + &string(14) "obj->b.changed" + ["c"]=> + string(14) "obj->c.changed" +} + + +--- a refs c: +object(stdClass)#%d (3) { + ["c"]=> + &int(1) + ["a"]=> + &int(1) + ["b"]=> + int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"c";i:1;S:1:"a";R:2;S:1:"b";i:1;}" +object(stdClass)#%d (3) { + ["c"]=> + &int(1) + ["a"]=> + &int(1) + ["b"]=> + int(1) +} +object(stdClass)#%d (3) { + ["c"]=> + &string(14) "obj->a.changed" + ["a"]=> + &string(14) "obj->a.changed" + ["b"]=> + int(1) +} +object(stdClass)#%d (3) { + ["c"]=> + &string(14) "obj->a.changed" + ["a"]=> + &string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + ["c"]=> + &string(14) "obj->c.changed" + ["a"]=> + &string(14) "obj->c.changed" + ["b"]=> + string(14) "obj->b.changed" +} + + +--- b refs a: +object(stdClass)#%d (3) { + ["a"]=> + &int(1) + ["b"]=> + &int(1) + ["c"]=> + int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";i:1;S:1:"b";R:2;S:1:"c";i:1;}" +object(stdClass)#%d (3) { + ["a"]=> + &int(1) + ["b"]=> + &int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->a.changed" + ["b"]=> + &string(14) "obj->a.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->b.changed" + ["b"]=> + &string(14) "obj->b.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->b.changed" + ["b"]=> + &string(14) "obj->b.changed" + ["c"]=> + string(14) "obj->c.changed" +} + + +--- b refs c: +object(stdClass)#%d (3) { + ["a"]=> + int(1) + ["c"]=> + &int(1) + ["b"]=> + &int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";i:1;S:1:"c";i:1;S:1:"b";R:3;}" +object(stdClass)#%d (3) { + ["a"]=> + int(1) + ["c"]=> + &int(1) + ["b"]=> + &int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["c"]=> + &int(1) + ["b"]=> + &int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["c"]=> + &string(14) "obj->b.changed" + ["b"]=> + &string(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["c"]=> + &string(14) "obj->c.changed" + ["b"]=> + &string(14) "obj->c.changed" +} + + +--- c refs a: +object(stdClass)#%d (3) { + ["a"]=> + &int(1) + ["b"]=> + int(1) + ["c"]=> + &int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";i:1;S:1:"b";i:1;S:1:"c";R:2;}" +object(stdClass)#%d (3) { + ["a"]=> + &int(1) + ["b"]=> + int(1) + ["c"]=> + &int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->a.changed" + ["b"]=> + int(1) + ["c"]=> + &string(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + &string(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->c.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + &string(14) "obj->c.changed" +} + + +--- c refs b: +object(stdClass)#%d (3) { + ["a"]=> + int(1) + ["b"]=> + &int(1) + ["c"]=> + &int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";i:1;S:1:"b";i:1;S:1:"c";R:3;}" +object(stdClass)#%d (3) { + ["a"]=> + int(1) + ["b"]=> + &int(1) + ["c"]=> + &int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + &int(1) + ["c"]=> + &int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + &string(14) "obj->b.changed" + ["c"]=> + &string(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + &string(14) "obj->c.changed" + ["c"]=> + &string(14) "obj->c.changed" +} + + +--- a,b refs c: +object(stdClass)#%d (3) { + ["c"]=> + &int(1) + ["a"]=> + &int(1) + ["b"]=> + &int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"c";i:1;S:1:"a";R:2;S:1:"b";R:2;}" +object(stdClass)#%d (3) { + ["c"]=> + &int(1) + ["a"]=> + &int(1) + ["b"]=> + &int(1) +} +object(stdClass)#%d (3) { + ["c"]=> + &string(14) "obj->a.changed" + ["a"]=> + &string(14) "obj->a.changed" + ["b"]=> + &string(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + ["c"]=> + &string(14) "obj->b.changed" + ["a"]=> + &string(14) "obj->b.changed" + ["b"]=> + &string(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + ["c"]=> + &string(14) "obj->c.changed" + ["a"]=> + &string(14) "obj->c.changed" + ["b"]=> + &string(14) "obj->c.changed" +} + + +--- a,c refs b: +object(stdClass)#%d (3) { + ["b"]=> + &int(1) + ["a"]=> + &int(1) + ["c"]=> + &int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"b";i:1;S:1:"a";R:2;S:1:"c";R:2;}" +object(stdClass)#%d (3) { + ["b"]=> + &int(1) + ["a"]=> + &int(1) + ["c"]=> + &int(1) +} +object(stdClass)#%d (3) { + ["b"]=> + &string(14) "obj->a.changed" + ["a"]=> + &string(14) "obj->a.changed" + ["c"]=> + &string(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + ["b"]=> + &string(14) "obj->b.changed" + ["a"]=> + &string(14) "obj->b.changed" + ["c"]=> + &string(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + ["b"]=> + &string(14) "obj->c.changed" + ["a"]=> + &string(14) "obj->c.changed" + ["c"]=> + &string(14) "obj->c.changed" +} + + +--- b,c refs a: +object(stdClass)#%d (3) { + ["a"]=> + &int(1) + ["b"]=> + &int(1) + ["c"]=> + &int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";i:1;S:1:"b";R:2;S:1:"c";R:2;}" +object(stdClass)#%d (3) { + ["a"]=> + &int(1) + ["b"]=> + &int(1) + ["c"]=> + &int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->a.changed" + ["b"]=> + &string(14) "obj->a.changed" + ["c"]=> + &string(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->b.changed" + ["b"]=> + &string(14) "obj->b.changed" + ["c"]=> + &string(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->c.changed" + ["b"]=> + &string(14) "obj->c.changed" + ["c"]=> + &string(14) "obj->c.changed" +} +Done +--UEXPECTF-- +--- a refs b: +object(stdClass)#%d (3) { + [u"b"]=> + &int(1) + [u"a"]=> + &int(1) + [u"c"]=> + int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"b";i:1;U:1:"a";R:2;U:1:"c";i:1;}" +object(stdClass)#%d (3) { + [u"b"]=> + &int(1) + [u"a"]=> + &int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"b"]=> + &unicode(14) "obj->a.changed" + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + unicode(14) "obj->c.changed" +} + + +--- a refs c: +object(stdClass)#%d (3) { + [u"c"]=> + &int(1) + [u"a"]=> + &int(1) + [u"b"]=> + int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"c";i:1;U:1:"a";R:2;U:1:"b";i:1;}" +object(stdClass)#%d (3) { + [u"c"]=> + &int(1) + [u"a"]=> + &int(1) + [u"b"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"c"]=> + &unicode(14) "obj->a.changed" + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"b"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"c"]=> + &unicode(14) "obj->a.changed" + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + [u"c"]=> + &unicode(14) "obj->c.changed" + [u"a"]=> + &unicode(14) "obj->c.changed" + [u"b"]=> + unicode(14) "obj->b.changed" +} + + +--- b refs a: +object(stdClass)#%d (3) { + [u"a"]=> + &int(1) + [u"b"]=> + &int(1) + [u"c"]=> + int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";i:1;U:1:"b";R:2;U:1:"c";i:1;}" +object(stdClass)#%d (3) { + [u"a"]=> + &int(1) + [u"b"]=> + &int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"b"]=> + &unicode(14) "obj->a.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + unicode(14) "obj->c.changed" +} + + +--- b refs c: +object(stdClass)#%d (3) { + [u"a"]=> + int(1) + [u"c"]=> + &int(1) + [u"b"]=> + &int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";i:1;U:1:"c";i:1;U:1:"b";R:3;}" +object(stdClass)#%d (3) { + [u"a"]=> + int(1) + [u"c"]=> + &int(1) + [u"b"]=> + &int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"c"]=> + &int(1) + [u"b"]=> + &int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"c"]=> + &unicode(14) "obj->b.changed" + [u"b"]=> + &unicode(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"c"]=> + &unicode(14) "obj->c.changed" + [u"b"]=> + &unicode(14) "obj->c.changed" +} + + +--- c refs a: +object(stdClass)#%d (3) { + [u"a"]=> + &int(1) + [u"b"]=> + int(1) + [u"c"]=> + &int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";i:1;U:1:"b";i:1;U:1:"c";R:2;}" +object(stdClass)#%d (3) { + [u"a"]=> + &int(1) + [u"b"]=> + int(1) + [u"c"]=> + &int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"b"]=> + int(1) + [u"c"]=> + &unicode(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + &unicode(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->c.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + &unicode(14) "obj->c.changed" +} + + +--- c refs b: +object(stdClass)#%d (3) { + [u"a"]=> + int(1) + [u"b"]=> + &int(1) + [u"c"]=> + &int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";i:1;U:1:"b";i:1;U:1:"c";R:3;}" +object(stdClass)#%d (3) { + [u"a"]=> + int(1) + [u"b"]=> + &int(1) + [u"c"]=> + &int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + &int(1) + [u"c"]=> + &int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + &unicode(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + &unicode(14) "obj->c.changed" + [u"c"]=> + &unicode(14) "obj->c.changed" +} + + +--- a,b refs c: +object(stdClass)#%d (3) { + [u"c"]=> + &int(1) + [u"a"]=> + &int(1) + [u"b"]=> + &int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"c";i:1;U:1:"a";R:2;U:1:"b";R:2;}" +object(stdClass)#%d (3) { + [u"c"]=> + &int(1) + [u"a"]=> + &int(1) + [u"b"]=> + &int(1) +} +object(stdClass)#%d (3) { + [u"c"]=> + &unicode(14) "obj->a.changed" + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"b"]=> + &unicode(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + [u"c"]=> + &unicode(14) "obj->b.changed" + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"b"]=> + &unicode(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + [u"c"]=> + &unicode(14) "obj->c.changed" + [u"a"]=> + &unicode(14) "obj->c.changed" + [u"b"]=> + &unicode(14) "obj->c.changed" +} + + +--- a,c refs b: +object(stdClass)#%d (3) { + [u"b"]=> + &int(1) + [u"a"]=> + &int(1) + [u"c"]=> + &int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"b";i:1;U:1:"a";R:2;U:1:"c";R:2;}" +object(stdClass)#%d (3) { + [u"b"]=> + &int(1) + [u"a"]=> + &int(1) + [u"c"]=> + &int(1) +} +object(stdClass)#%d (3) { + [u"b"]=> + &unicode(14) "obj->a.changed" + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"c"]=> + &unicode(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + &unicode(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + [u"b"]=> + &unicode(14) "obj->c.changed" + [u"a"]=> + &unicode(14) "obj->c.changed" + [u"c"]=> + &unicode(14) "obj->c.changed" +} + + +--- b,c refs a: +object(stdClass)#%d (3) { + [u"a"]=> + &int(1) + [u"b"]=> + &int(1) + [u"c"]=> + &int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";i:1;U:1:"b";R:2;U:1:"c";R:2;}" +object(stdClass)#%d (3) { + [u"a"]=> + &int(1) + [u"b"]=> + &int(1) + [u"c"]=> + &int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"b"]=> + &unicode(14) "obj->a.changed" + [u"c"]=> + &unicode(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + &unicode(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->c.changed" + [u"b"]=> + &unicode(14) "obj->c.changed" + [u"c"]=> + &unicode(14) "obj->c.changed" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_objects_014.phpt b/ext/standard/tests/serialize/serialization_objects_014.phpt new file mode 100644 index 00000000000..a17e8c609d4 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_014.phpt @@ -0,0 +1,515 @@ +--TEST-- +Object serialization / unserialization: references to external values +--INI-- +error_reporting = E_ALL & ~E_STRICT +--FILE-- +a = "obj->a.changed"; + var_dump($uobj); + $uobj->b = "obj->b.changed"; + var_dump($uobj); + $uobj->c = "obj->c.changed"; + var_dump($uobj); +} + +echo "\n\n--- a refs external:\n"; +$ext = 1; +$obj = new stdClass; +$obj->a = &$ext; +$obj->b = 1; +$obj->c = 1; +check($obj); + +echo "\n\n--- b refs external:\n"; +$ext = 1; +$obj = new stdClass; +$obj->a = 1; +$obj->b = &$ext; +$obj->c = 1; +check($obj); + +echo "\n\n--- c refs external:\n"; +$ext = 1; +$obj = new stdClass; +$obj->a = 1; +$obj->b = 1; +$obj->c = &$ext; +check($obj); + +echo "\n\n--- a,b ref external:\n"; +$ext = 1; +$obj = new stdClass; +$obj->a = &$ext; +$obj->b = &$ext; +$obj->c = 1; +check($obj); + +echo "\n\n--- a,b,c ref external:\n"; +$ext = 1; +$obj = new stdClass; +$obj->a = &$ext; +$obj->b = &$ext; +$obj->c = &$ext; +check($obj); + +echo "Done"; +?> +--EXPECTF-- + +--- a refs external: +object(stdClass)#%d (3) { + ["a"]=> + &int(1) + ["b"]=> + int(1) + ["c"]=> + int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";i:1;S:1:"b";i:1;S:1:"c";i:1;}" +object(stdClass)#%d (3) { + ["a"]=> + int(1) + ["b"]=> + int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + string(14) "obj->c.changed" +} + + +--- b refs external: +object(stdClass)#%d (3) { + ["a"]=> + int(1) + ["b"]=> + &int(1) + ["c"]=> + int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";i:1;S:1:"b";i:1;S:1:"c";i:1;}" +object(stdClass)#%d (3) { + ["a"]=> + int(1) + ["b"]=> + int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + string(14) "obj->c.changed" +} + + +--- c refs external: +object(stdClass)#%d (3) { + ["a"]=> + int(1) + ["b"]=> + int(1) + ["c"]=> + &int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";i:1;S:1:"b";i:1;S:1:"c";i:1;}" +object(stdClass)#%d (3) { + ["a"]=> + int(1) + ["b"]=> + int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + string(14) "obj->c.changed" +} + + +--- a,b ref external: +object(stdClass)#%d (3) { + ["a"]=> + &int(1) + ["b"]=> + &int(1) + ["c"]=> + int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";i:1;S:1:"b";R:2;S:1:"c";i:1;}" +object(stdClass)#%d (3) { + ["a"]=> + &int(1) + ["b"]=> + &int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->a.changed" + ["b"]=> + &string(14) "obj->a.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->b.changed" + ["b"]=> + &string(14) "obj->b.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->b.changed" + ["b"]=> + &string(14) "obj->b.changed" + ["c"]=> + string(14) "obj->c.changed" +} + + +--- a,b,c ref external: +object(stdClass)#%d (3) { + ["a"]=> + &int(1) + ["b"]=> + &int(1) + ["c"]=> + &int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";i:1;S:1:"b";R:2;S:1:"c";R:2;}" +object(stdClass)#%d (3) { + ["a"]=> + &int(1) + ["b"]=> + &int(1) + ["c"]=> + &int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->a.changed" + ["b"]=> + &string(14) "obj->a.changed" + ["c"]=> + &string(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->b.changed" + ["b"]=> + &string(14) "obj->b.changed" + ["c"]=> + &string(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->c.changed" + ["b"]=> + &string(14) "obj->c.changed" + ["c"]=> + &string(14) "obj->c.changed" +} +Done +--UEXPECTF-- +--- a refs external: +object(stdClass)#%d (3) { + [u"a"]=> + &int(1) + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";i:1;U:1:"b";i:1;U:1:"c";i:1;}" +object(stdClass)#%d (3) { + [u"a"]=> + int(1) + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + unicode(14) "obj->c.changed" +} + + +--- b refs external: +object(stdClass)#%d (3) { + [u"a"]=> + int(1) + [u"b"]=> + &int(1) + [u"c"]=> + int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";i:1;U:1:"b";i:1;U:1:"c";i:1;}" +object(stdClass)#%d (3) { + [u"a"]=> + int(1) + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + unicode(14) "obj->c.changed" +} + + +--- c refs external: +object(stdClass)#%d (3) { + [u"a"]=> + int(1) + [u"b"]=> + int(1) + [u"c"]=> + &int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";i:1;U:1:"b";i:1;U:1:"c";i:1;}" +object(stdClass)#%d (3) { + [u"a"]=> + int(1) + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + unicode(14) "obj->c.changed" +} + + +--- a,b ref external: +object(stdClass)#%d (3) { + [u"a"]=> + &int(1) + [u"b"]=> + &int(1) + [u"c"]=> + int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";i:1;U:1:"b";R:2;U:1:"c";i:1;}" +object(stdClass)#%d (3) { + [u"a"]=> + &int(1) + [u"b"]=> + &int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"b"]=> + &unicode(14) "obj->a.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + unicode(14) "obj->c.changed" +} + + +--- a,b,c ref external: +object(stdClass)#%d (3) { + [u"a"]=> + &int(1) + [u"b"]=> + &int(1) + [u"c"]=> + &int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";i:1;U:1:"b";R:2;U:1:"c";R:2;}" +object(stdClass)#%d (3) { + [u"a"]=> + &int(1) + [u"b"]=> + &int(1) + [u"c"]=> + &int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"b"]=> + &unicode(14) "obj->a.changed" + [u"c"]=> + &unicode(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + &unicode(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->c.changed" + [u"b"]=> + &unicode(14) "obj->c.changed" + [u"c"]=> + &unicode(14) "obj->c.changed" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_objects_015.phpt b/ext/standard/tests/serialize/serialization_objects_015.phpt new file mode 100644 index 00000000000..1b4472c8670 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_015.phpt @@ -0,0 +1,992 @@ +--TEST-- +Object serialization / unserialization: properties reference containing object +--INI-- +error_reporting = E_ALL & ~E_STRICT +--FILE-- +a = "obj->a.changed"; + var_dump($uobj); + $uobj->b = "obj->b.changed"; + var_dump($uobj); + $uobj->c = "obj->c.changed"; + var_dump($uobj); +} + +echo "\n\n--- a refs container:\n"; +$ext = 1; +$obj = new stdClass; +$obj->a = &$obj; +$obj->b = 1; +$obj->c = 1; +check($obj); + +echo "\n\n--- a eqs container:\n"; +$ext = 1; +$obj = new stdClass; +$obj->a = $obj; +$obj->b = 1; +$obj->c = 1; +check($obj); + +echo "\n\n--- a,b ref container:\n"; +$ext = 1; +$obj = new stdClass; +$obj->a = &$obj; +$obj->b = &$obj; +$obj->c = 1; +check($obj); + +echo "\n\n--- a,b eq container:\n"; +$ext = 1; +$obj = new stdClass; +$obj->a = $obj; +$obj->b = $obj; +$obj->c = 1; +check($obj); + +echo "\n\n--- a,b,c ref container:\n"; +$ext = 1; +$obj = new stdClass; +$obj->a = &$obj; +$obj->b = &$obj; +$obj->c = &$obj; +check($obj); + +echo "\n\n--- a,b,c eq container:\n"; +$ext = 1; +$obj = new stdClass; +$obj->a = $obj; +$obj->b = $obj; +$obj->c = $obj; +check($obj); + +echo "Done"; +?> +--EXPECTF-- +--- a refs container: +object(stdClass)#%d (3) { + ["a"]=> + &object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + int(1) + ["c"]=> + int(1) + } + ["b"]=> + int(1) + ["c"]=> + int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";R:1;S:1:"b";i:1;S:1:"c";i:1;}" +object(stdClass)#%d (3) { + ["a"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + int(1) + ["c"]=> + int(1) + } + ["b"]=> + int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + string(14) "obj->c.changed" +} + + +--- a eqs container: +object(stdClass)#%d (3) { + ["a"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + int(1) + ["c"]=> + int(1) + } + ["b"]=> + int(1) + ["c"]=> + int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";r:1;S:1:"b";i:1;S:1:"c";i:1;}" +object(stdClass)#%d (3) { + ["a"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + int(1) + ["c"]=> + int(1) + } + ["b"]=> + int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + int(1) + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + string(14) "obj->c.changed" +} + + +--- a,b ref container: +object(stdClass)#%d (3) { + ["a"]=> + &object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + int(1) + } + ["b"]=> + &object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + int(1) + } + ["c"]=> + int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";R:1;S:1:"b";R:1;S:1:"c";i:1;}" +object(stdClass)#%d (3) { + ["a"]=> + &object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + int(1) + } + ["b"]=> + &object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + int(1) + } + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->a.changed" + ["b"]=> + &string(14) "obj->a.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->b.changed" + ["b"]=> + &string(14) "obj->b.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->b.changed" + ["b"]=> + &string(14) "obj->b.changed" + ["c"]=> + string(14) "obj->c.changed" +} + + +--- a,b eq container: +object(stdClass)#%d (3) { + ["a"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + int(1) + } + ["b"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + int(1) + } + ["c"]=> + int(1) +} +string(55) "O:8:"stdClass":3:{S:1:"a";r:1;S:1:"b";r:1;S:1:"c";i:1;}" +object(stdClass)#%d (3) { + ["a"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + int(1) + } + ["b"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + int(1) + } + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + *RECURSION* + ["c"]=> + int(1) + } + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + int(1) +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + string(14) "obj->c.changed" +} + + +--- a,b,c ref container: +object(stdClass)#%d (3) { + ["a"]=> + &object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } + ["b"]=> + &object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } + ["c"]=> + &object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } +} +string(55) "O:8:"stdClass":3:{S:1:"a";R:1;S:1:"b";R:1;S:1:"c";R:1;}" +object(stdClass)#%d (3) { + ["a"]=> + &object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } + ["b"]=> + &object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } + ["c"]=> + &object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->a.changed" + ["b"]=> + &string(14) "obj->a.changed" + ["c"]=> + &string(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->b.changed" + ["b"]=> + &string(14) "obj->b.changed" + ["c"]=> + &string(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + ["a"]=> + &string(14) "obj->c.changed" + ["b"]=> + &string(14) "obj->c.changed" + ["c"]=> + &string(14) "obj->c.changed" +} + + +--- a,b,c eq container: +object(stdClass)#%d (3) { + ["a"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } + ["b"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } + ["c"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } +} +string(55) "O:8:"stdClass":3:{S:1:"a";r:1;S:1:"b";r:1;S:1:"c";r:1;}" +object(stdClass)#%d (3) { + ["a"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } + ["b"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } + ["c"]=> + object(stdClass)#%d (3) { + ["a"]=> + *RECURSION* + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } + ["c"]=> + object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + *RECURSION* + ["c"]=> + *RECURSION* + } +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + *RECURSION* + } +} +object(stdClass)#%d (3) { + ["a"]=> + string(14) "obj->a.changed" + ["b"]=> + string(14) "obj->b.changed" + ["c"]=> + string(14) "obj->c.changed" +} +Done +--UEXPECTF-- +--- a refs container: +object(stdClass)#%d (3) { + [u"a"]=> + &object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + int(1) + [u"c"]=> + int(1) + } + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";R:1;U:1:"b";i:1;U:1:"c";i:1;}" +object(stdClass)#%d (3) { + [u"a"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + int(1) + [u"c"]=> + int(1) + } + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + unicode(14) "obj->c.changed" +} + + +--- a eqs container: +object(stdClass)#%d (3) { + [u"a"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + int(1) + [u"c"]=> + int(1) + } + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";r:1;U:1:"b";i:1;U:1:"c";i:1;}" +object(stdClass)#%d (3) { + [u"a"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + int(1) + [u"c"]=> + int(1) + } + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + int(1) + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + unicode(14) "obj->c.changed" +} + + +--- a,b ref container: +object(stdClass)#%d (3) { + [u"a"]=> + &object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + int(1) + } + [u"b"]=> + &object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + int(1) + } + [u"c"]=> + int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";R:1;U:1:"b";R:1;U:1:"c";i:1;}" +object(stdClass)#%d (3) { + [u"a"]=> + &object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + int(1) + } + [u"b"]=> + &object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + int(1) + } + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"b"]=> + &unicode(14) "obj->a.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + unicode(14) "obj->c.changed" +} + + +--- a,b eq container: +object(stdClass)#%d (3) { + [u"a"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + int(1) + } + [u"b"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + int(1) + } + [u"c"]=> + int(1) +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";r:1;U:1:"b";r:1;U:1:"c";i:1;}" +object(stdClass)#%d (3) { + [u"a"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + int(1) + } + [u"b"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + int(1) + } + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + *RECURSION* + [u"c"]=> + int(1) + } + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + int(1) +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + unicode(14) "obj->c.changed" +} + + +--- a,b,c ref container: +object(stdClass)#%d (3) { + [u"a"]=> + &object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } + [u"b"]=> + &object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } + [u"c"]=> + &object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";R:1;U:1:"b";R:1;U:1:"c";R:1;}" +object(stdClass)#%d (3) { + [u"a"]=> + &object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } + [u"b"]=> + &object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } + [u"c"]=> + &object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->a.changed" + [u"b"]=> + &unicode(14) "obj->a.changed" + [u"c"]=> + &unicode(14) "obj->a.changed" +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->b.changed" + [u"b"]=> + &unicode(14) "obj->b.changed" + [u"c"]=> + &unicode(14) "obj->b.changed" +} +object(stdClass)#%d (3) { + [u"a"]=> + &unicode(14) "obj->c.changed" + [u"b"]=> + &unicode(14) "obj->c.changed" + [u"c"]=> + &unicode(14) "obj->c.changed" +} + + +--- a,b,c eq container: +object(stdClass)#%d (3) { + [u"a"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } + [u"b"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } + [u"c"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } +} +unicode(55) "O:8:"stdClass":3:{U:1:"a";r:1;U:1:"b";r:1;U:1:"c";r:1;}" +object(stdClass)#%d (3) { + [u"a"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } + [u"b"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } + [u"c"]=> + object(stdClass)#%d (3) { + [u"a"]=> + *RECURSION* + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } + [u"c"]=> + object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + *RECURSION* + [u"c"]=> + *RECURSION* + } +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + *RECURSION* + } +} +object(stdClass)#%d (3) { + [u"a"]=> + unicode(14) "obj->a.changed" + [u"b"]=> + unicode(14) "obj->b.changed" + [u"c"]=> + unicode(14) "obj->c.changed" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_precision_001.phpt b/ext/standard/tests/serialize/serialization_precision_001.phpt new file mode 100644 index 00000000000..9183dbe0a44 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_precision_001.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test serialize_precision (part 1) +--INI-- +serialize_precision=10 +--FILE-- + +--EXPECTF-- +string(6) "d:0.1;" +--UEXPECTF-- +unicode(6) "d:0.1;" \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_precision_002.phpt b/ext/standard/tests/serialize/serialization_precision_002.phpt new file mode 100644 index 00000000000..980a49f24bd --- /dev/null +++ b/ext/standard/tests/serialize/serialization_precision_002.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test serialize_precision (part 2) +--INI-- +serialize_precision=75 +--FILE-- + +--EXPECTF-- +string(60) "d:0.1000000000000000055511151231257827021181583404541015625;" +--UEXPECTF-- +unicode(60) "d:0.1000000000000000055511151231257827021181583404541015625;" \ No newline at end of file diff --git a/ext/standard/tests/serialize/serialization_resources_001.phpt b/ext/standard/tests/serialize/serialization_resources_001.phpt new file mode 100644 index 00000000000..8f970fb48de --- /dev/null +++ b/ext/standard/tests/serialize/serialization_resources_001.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test serialize() & unserialize() functions: resources +--FILE-- + +--EXPECTF-- +--- Testing Resource --- +string(4) "i:%d;" +int(%d) + +Done +--UEXPECTF-- +--- Testing Resource --- +unicode(4) "i:%d;" +int(%d) + +Done \ No newline at end of file