From dc2a59a97038c0bee05ffae801d039bc2670e635 Mon Sep 17 00:00:00 2001 From: Robin Fernandes Date: Tue, 18 Mar 2008 15:11:12 +0000 Subject: [PATCH] Adding more tests for serialize() and unserialize(). --- ext/standard/tests/serialize/005.phpt | 2 +- .../serialize/serialization_arrays_001.phpt | 106 ++++ .../serialize/serialization_arrays_002.phpt | 544 +++++++++++++++++ .../serialize/serialization_arrays_003.phpt | 294 +++++++++ .../serialize/serialization_arrays_004.phpt | 467 ++++++++++++++ .../serialize/serialization_arrays_005.phpt | 571 ++++++++++++++++++ .../serialize/serialization_error_001.phpt | 42 ++ .../serialization_miscTypes_001.phpt | Bin 0 -> 7583 bytes .../serialize/serialization_objects_001.phpt | Bin 0 -> 2373 bytes .../serialize/serialization_objects_002.phpt | Bin 0 -> 7192 bytes .../serialize/serialization_objects_003.phpt | 67 ++ .../serialize/serialization_objects_004.phpt | 49 ++ .../serialize/serialization_objects_005.phpt | 120 ++++ .../serialize/serialization_objects_006.phpt | 28 + .../serialize/serialization_objects_007.phpt | 42 ++ .../serialize/serialization_objects_008.phpt | 28 + .../serialize/serialization_objects_009.phpt | 36 ++ .../serialize/serialization_objects_010.phpt | 37 ++ .../serialize/serialization_objects_011.phpt | 196 ++++++ .../serialize/serialization_objects_012.phpt | 244 ++++++++ .../serialize/serialization_objects_013.phpt | 494 +++++++++++++++ .../serialize/serialization_objects_014.phpt | 295 +++++++++ .../serialize/serialization_objects_015.phpt | 532 ++++++++++++++++ .../serialization_precision_001.phpt | 21 + .../serialization_precision_002.phpt | 21 + .../serialization_resources_001.phpt | 30 + 26 files changed, 4265 insertions(+), 1 deletion(-) 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 d67f6fbf70..e7b23db701 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" } 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 0000000000..f62f698554 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_arrays_001.phpt @@ -0,0 +1,106 @@ +--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 \ 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 0000000000..f8cef7818e --- /dev/null +++ b/ext/standard/tests/serialize/serialization_arrays_002.phpt @@ -0,0 +1,544 @@ +--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 \ 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 0000000000..8d664fccf3 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_arrays_003.phpt @@ -0,0 +1,294 @@ +--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 \ 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 0000000000..942afdfb93 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_arrays_004.phpt @@ -0,0 +1,467 @@ +--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 \ 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 0000000000..dd3e436edd --- /dev/null +++ b/ext/standard/tests/serialize/serialization_arrays_005.phpt @@ -0,0 +1,571 @@ +--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" + } +} 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 0000000000..3f530580d6 --- /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..c38b0bbe230f0c52b9ca919aa149602f34a628fb GIT binary patch literal 7583 zcmb_hZEw>^5WcVESFCasB#=T#$uPa`5hQs66Cr2>pA&$) zSn_^{J!G$VIW5u^Ld5JXuhvCYvP4ZS_^RL~&#D9!SU#^Ov)-3QI$f}7lCfn{@q%6O zw&}Az!{y)Q>tf2;G@tR9@vG{vtdeY&6thFH;_(z!UM$n3WMFQ~RgfS4z$xKFJ4n(^ z<<|M8(c4~5lK;4wk6YDreGo&l)g$ zz=qC%xsP4?3|Kem4#f0cU)`L(KRM~c!kq&&mDW3l6~F?q4n&19Kz*H6{1Y!q+&hps zwikLMH}Jv%J`T0#`f;QU!!znzSI5VeWjpQw7C&SQe#KG=K+84bLOVPbAF-NsRX>w? z*44-oA2r@Q(|iE({2&xy`Ls%w8k|xf<5Y~5uObi-F*NlXFLK70{1WP>#KpxZ#2P~l zK_{pnz}UN<*C&gFj@S~lBcR~H*MIE${(w#1zCRkU;}<9I;DUPsy9Jx|-~n72+#r(p z)Yd3qXCOsjVONw3Ovv~bsPh>lNl9kXWMR#Hl`O)ew|veEo_p^9v1VUgM|qWo#gq7Rf{5D ze_G%!0bx~)C&17$6Cs^poU`O2{|tYLA;9^0Ui8>O3dL-V@%jgF^*XD1o3-A@u}6k}3fMYJmp+;UN78 zUQ$@jXY0!q7+mX$$ryx9RE()ORdw8Eq(*LudfL)Da7(p@zEQM(mc7a|4($ExDIC#9 z|GYVRIXQ+?dMDj?V7L`V3!>QhLF7c@^lZ1!x@lZ9XgKc58I5(d*Fc)RMzgP>*#>AH zp|$vXA6!dS$8!wu(7RdV-Dnrwe3>UL|3*5VYk-IT&Em#r1HhKDj_4U6I%5BV&>e+# zXzy~6wofVQSiS+4$d#d^*4PKuXzFNzFW}H#-w#I2}%dZ1h{JQcBJpgo=K>&{)e5v;v@3+fGyBPameSGp1uE+;Aywk7` zb|Y{|;4}i41a2cx;3W4Nx#&Q*{Wf4R*TQm0VmnZtf8YCAOs^NR{icgOf>#3@K28({ zPGG@nf)jX=<64m)TCVN*Do7Y9e+=x5O|TcWKB4W0BPX)_AoAf~Q}`Q=OUQ_B7jEGVs=2q}-j1Om#Q|q5(gto_xOJ6_o0}_iZa~R{ z$w91oYh1w}{}qo=GJA;)c9*hn|90Duvig2o`hJT9XzjO10J-1dOr)T1ZMR1fUnGD~ z6z>-#4}=_>;~sXxBn(?Z>V-)<5>jkuF&QKAC>sL{L80R zPi<`fcZc=lS~uH;WO771$ht`!swC6vXeekz781Ov*R^C@w&#Y{2 z0UkyLRdp-_(zr7$1Ma}1t&E+x3%|Y@c!fL(nwnGY&+x}R6CC7^ds{FD{DG-~UFD8C zYqd|C_2n86$F0^kU<|Rowby>x>1hra5X9{OO!xp1s5<2juO|DA)v46=Xbda%SODbHDjEFinT%%;iwsg>P{9Q2yptx_^5^+N#RzepAP2lL zEp0@W2$i&m#a?V7uTv>B5Z#(i+Hd_tRH31MLQZBWYrIbSp~{i?hQFtgsDi>+AqmtV z%^yo*7|(L>F0vp9zz*Kd#|;%|?;`X1jK!(Y8ZPm2f=UCsV?YCyS409Dq;gy?1`vh) zRWLVX3mUBpm&*Zo#ovd`d1PKUGyPt(^4xvW%AF2ZIMlVKvSHB(V4CK_RMxdEDH@g0N6QnST>>U~ zp87^D>^lfc^0~{14!cC@JwM={6Yud3ztg-Oa&OCRZPiY|>q|}-QS+!rfE^bq#nL`) zm)DR$RArT1XzUAHT=KA=@bVUh_uqc67e&3Wv)}8!=(W2C?dY%*?RO8l#Ih5$ySDXu g2g%$032iQy-ak0Qm7Sls*Z&8NfB$7=_Bmre0OpwB6951J 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..aeca6d81acf1989be5bc5fb3c1506f448b8738cf GIT binary patch literal 7192 zcmds6ZExE~682~PiUm(SOM&F@T_RPd$l1=}03#_H=TN{Y42q&G-YKLZQjHTs|NWlX z*;!B4zDiWUk!(ytE{R;m96q*nSafCeerj(E}HN2b&=M2 zSyZtor~k>)x)Qx#6RelSerGs*^RLSbob>$qgC9By>XmOI#lGn>TsRYz* z7!CT%14gk8O?N3XwOKc9r5{^)mHapReKtZ>vC7g_1_LXR*WYYXCrcNlus#;U;ZRT( zP<;Mv0xR;u#2YI<7S^QGNta1giBH+5X|}3F=bNcWk*rq9m)_8^?GwlK24=%RT>bRnqCe?uv_3_tHF^++ zcqT|YC?&edKy;_LQ`|G$8SXjmTigqhucIw)Zc-$Ay;`R=DuE6VqFXQWYWOM<+9*Ss zg48s_Fj6o`NjlpQXCMyU6VJ!hVq{>jvCcraC$76|>p-#l0|b5FRb-!aPoIx%#MF)owLBYw;wJqiMZJY;GD`S zD`u5oukZDz=zfO3?{R;@{Z;JoZ})Rc8u_<--y)G`yI)!)@@x02(TEa_vFQeIbpywO z&+diN$;Nh~wnA8Q^2CgX7jh*0&Y!R)#=h7N|t&EZnnWC+u*2BfJ9{O{il@ zn^kVHC@s((cmt(R9{|Qz(?ygJoOE;$?vJ+BvZj%qSl3L$ecIsY{sdAw1iBiRbVE|u zUx;M66!juA5LGW$<@$CZmSuTIfITmPlqZe~eMSYQYc!G{T1Qv`#v^`|?K%@W>2>>XhrOsCxu*XSu)V1u;(Yyvwi zy0O>@2Q+HPKQD_6cKz@Q-TUI_A1}_X-k^d1u13)5ye;cIMGO5<%(8i20Nist-N(Su zEpSl#_^uKqIx?0B&)>ICmMXe`{KU>6{G&TVyK^9^7_Jh7dx?aX2s+9p`ypc zn&dIsmwcI8_zh!SUrbD`$uxHOd1g&!v4(YfdyOLB8;7IOI2c8v$hGa!*!ChPj6BB) zT+jDL0Uv-kB=IPI$YY!2%6k@58`vI(CnpNLC~~pY^KEw&1dikQK@d43FBp5#SRR_dtjKWy?in7o5LOSMcZ_Q-D6j;$j_I-)#MoqX#HIN|7pVyQ0v*f%&u zZk9cq48!4M7+j?Kc*7_^3>_!5JwFV_p&N``2hQ<>Q9!mjZXjLJ@;=!|p5MTXaPoGt zkujQEuqcWx)7&g+spQ>SSSFtq^t7>5O6(~-F5=!<|8L*TL~qRP=^E+q%jqkWZC=zp z$0h*0wx)`v@+d?W@uMZ#sbWvda@nJnz`JIOJYSYc-P1Y4yiD;JXh*s?UfV2OiD&q| zb~KSsqFhlNS9A7i2Gu>iprsoazGkonw$@++i@**vTX{*P3i}FG^dOg!ZyL!H>m<^f zn_iU1s?{o=uwG}@cE{Qi{p%!Y2l6| zX)YqN@>{4Cqb3Okk*}?}inem5NnCcP@;xuTRZG?WYirRYY<>gb92{@kcl*ibB`-Y&RNvF1kSkM0IV6p%VLK zlS0CiDt|^Oxy0a!b~rT|dN4x=RhJ~q*X_VEN2&hj#1_K#*No};h^%>*vw(6c+&o3I zlP-VWT4{mKwjb?~wR--<}UdwM=qYjUZ1Ou;J}20`@Dv!#~khXyM9PArQohAlFnASX0 zjPLruoe&eXANhe}hk+e>{wNGE*vSS%1;f)Qjk$h1dOXJ=&`IpG$bADHO~-HLVe~IG zDU6$z8Um3J38wc4nl{ZTdY+~Z$G0bUvYi_i`@C7x8mG9W>$G83pogdJlp;q>Dpkx1 zW+-7Kq*?FLu-7Vk>}d~qrtrZrQ{LXpWA$|IvU>hw^`4ws%;aMfS1lLP&D^vl8C8`+ z1ie&TtctD^Rt1&EW9HUVJ32x}W7KQ75e%ab524D5O|6(ACkyF%qnl8FKQcqHHj=bt zO`p4D9s9t*p~f(Prh1ZaDGOr@lt9xXg|5$=?Pk2vIc^9#t9Ii22nz{bj~HH`+o#?k zpZ*2Dk2Qwx!%@jYny7>Ua;m52&5b9&9H0Jfl$9*My-}~f`OUZ&+swxH_aXyG<7=@A vAbKq2|AAmYZX?M7QEgP&f#)q~=puO%P#Irz`Ivgr&}azXUM(H^tKk0t>=~R4 literal 0 HcmV?d00001 diff --git a/ext/standard/tests/serialize/serialization_objects_003.phpt b/ext/standard/tests/serialize/serialization_objects_003.phpt new file mode 100644 index 0000000000..c20590b797 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_003.phpt @@ -0,0 +1,67 @@ +--TEST-- +Test serialize() & unserialize() functions: objects (abstract classes) +--FILE-- +a = 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 \ 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 0000000000..6b826a398b --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_004.phpt @@ -0,0 +1,49 @@ +--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 \ 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 0000000000..35b1593879 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_005.phpt @@ -0,0 +1,120 @@ +--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 \ 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 0000000000..e223f4ee12 --- /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 0000000000..9cba9d13b5 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_007.phpt @@ -0,0 +1,42 @@ +--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 \ 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 0000000000..b963872f28 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_008.phpt @@ -0,0 +1,28 @@ +--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 \ 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 0000000000..2e8b2dc80f --- /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 0000000000..0fbf0723df --- /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 0000000000..8707937805 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_011.phpt @@ -0,0 +1,196 @@ +--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: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: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:private"]=> + string(7) "B.BPriv" + ["BProt:protected"]=> + string(7) "B.BProt" + ["BPub"]=> + string(6) "B.BPub" + ["APriv: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:private"]=> + string(7) "B.BPriv" + ["BProt:protected"]=> + string(7) "B.BProt" + ["BPub"]=> + string(6) "B.BPub" + ["APriv: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:private"]=> + string(7) "C.APriv" + ["AProt:protected"]=> + string(7) "C.AProt" + ["APub"]=> + string(6) "C.APub" + ["CPriv:private"]=> + string(7) "C.CPriv" + ["CProt:protected"]=> + string(7) "C.BProt" + ["CPub"]=> + string(6) "C.CPub" + ["BPriv:private"]=> + string(7) "B.BPriv" + ["BProt:protected"]=> + string(7) "B.BProt" + ["BPub"]=> + string(6) "B.BPub" + ["APriv: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:private"]=> + string(7) "C.APriv" + ["AProt:protected"]=> + string(7) "C.AProt" + ["APub"]=> + string(6) "C.APub" + ["CPriv:private"]=> + string(7) "C.CPriv" + ["CProt:protected"]=> + string(7) "C.BProt" + ["CPub"]=> + string(6) "C.CPub" + ["BPriv:private"]=> + string(7) "B.BPriv" + ["BProt:protected"]=> + string(7) "B.BProt" + ["BPub"]=> + string(6) "B.BPub" + ["APriv:private"]=> + string(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 0000000000..f994d8e260 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_012.phpt @@ -0,0 +1,244 @@ +--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 \ 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 0000000000..01b623cb0d --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_013.phpt @@ -0,0 +1,494 @@ +--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 \ 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 0000000000..234f5e084c --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_014.phpt @@ -0,0 +1,295 @@ +--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 \ 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 0000000000..02e8279c4d --- /dev/null +++ b/ext/standard/tests/serialize/serialization_objects_015.phpt @@ -0,0 +1,532 @@ +--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 \ 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 0000000000..eb633beb74 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_precision_001.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test serialize_precision (part 1) +--INI-- +serialize_precision=10 +--FILE-- + +--EXPECTF-- +string(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 0000000000..653fabea36 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_precision_002.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test serialize_precision (part 2) +--INI-- +serialize_precision=75 +--FILE-- + +--EXPECTF-- +string(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 0000000000..dbb7d3d3e9 --- /dev/null +++ b/ext/standard/tests/serialize/serialization_resources_001.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test serialize() & unserialize() functions: resources +--FILE-- + +--EXPECTF-- +--- Testing Resource --- +string(4) "i:%d;" +int(%d) + +Done \ No newline at end of file -- 2.50.1