PATH:
opt
/
alt
/
tests
/
alt-php83-pecl-igbinary_3.2.15-1.el8
/
tests
--TEST-- __serialize() mechanism (016): Properties are still typed after unserialization (references) --SKIPIF-- <?php if (PHP_VERSION_ID < 70400) { echo "skip __serialize/__unserialize not supported in php < 7.4 for compatibility with serialize()"; } if (PHP_VERSION_ID >= 80000) { echo "skip different error message format"; } ?> --FILE-- <?php declare(strict_types=1); class Test { public int $i = 0; public ?string $s = 's'; public object $o; public stdClass $stdClass; public array $a = []; } $t = new Test(); $t->i = 1; $t->s = 'other'; $t->o = $t; $t->std = (object)['key' => 'value']; $t->a = [&$t->std, &$t->i, &$t->s, &$t->o]; $t->std->key = &$t->a; var_dump($t); var_dump(bin2hex($s = igbinary_serialize($t))); $t2 = igbinary_unserialize($s); var_dump($t2); try { $t2->i = 'x'; } catch (Error $e) { echo "i: " . $e->getMessage() . "\n"; } $t2->s = null; try { $t2->s = false; } catch (Error $e) { echo "s: " . $e->getMessage() . "\n"; } $t2->s = 'other'; try { $t2->o = null; } catch (Error $e) { echo "o: " . $e->getMessage() . "\n"; } try { $t2->a = null; } catch (Error $e) { echo "a: " . $e->getMessage() . "\n"; } try { $t2->stdClass = $t; } catch (Error $e) { echo "stdClass: " . $e->getMessage() . "\n"; } try { $t2->a = $t2; } catch (Error $e) { echo "a: " . $e->getMessage() . "\n"; } var_dump($t2); --EXPECT-- object(Test)#1 (5) { ["i"]=> &int(1) ["s"]=> &string(5) "other" ["o"]=> *RECURSION* ["stdClass"]=> uninitialized(stdClass) ["a"]=> &array(4) { [0]=> &object(stdClass)#2 (1) { ["key"]=> *RECURSION* } [1]=> &int(1) [2]=> &string(5) "other" [3]=> *RECURSION* } ["std"]=> &object(stdClass)#2 (1) { ["key"]=> &array(4) { [0]=> *RECURSION* [1]=> &int(1) [2]=> &string(5) "other" [3]=> *RECURSION* } } } string(176) "0000000217045465737414061101692506011101732511056f7468657211016f252200001101612514040600251708737464436c617373140111036b65792501030601250101060225010206032522001103737464252204" object(Test)#3 (5) { ["i"]=> &int(1) ["s"]=> &string(5) "other" ["o"]=> *RECURSION* ["stdClass"]=> uninitialized(stdClass) ["a"]=> &array(4) { [0]=> &object(stdClass)#4 (1) { ["key"]=> *RECURSION* } [1]=> &int(1) [2]=> &string(5) "other" [3]=> *RECURSION* } ["std"]=> &object(stdClass)#4 (1) { ["key"]=> &array(4) { [0]=> *RECURSION* [1]=> &int(1) [2]=> &string(5) "other" [3]=> *RECURSION* } } } i: Typed property Test::$i must be int, string used s: Typed property Test::$s must be string or null, bool used o: Typed property Test::$o must be object, null used a: Typed property Test::$a must be array, null used stdClass: Typed property Test::$stdClass must be an instance of stdClass, Test used a: Typed property Test::$a must be array, Test used object(Test)#3 (5) { ["i"]=> &int(1) ["s"]=> &string(5) "other" ["o"]=> *RECURSION* ["stdClass"]=> uninitialized(stdClass) ["a"]=> &array(4) { [0]=> &object(stdClass)#4 (1) { ["key"]=> *RECURSION* } [1]=> &int(1) [2]=> &string(5) "other" [3]=> *RECURSION* } ["std"]=> &object(stdClass)#4 (1) { ["key"]=> &array(4) { [0]=> *RECURSION* [1]=> &int(1) [2]=> &string(5) "other" [3]=> *RECURSION* } } }
[+]
..
[-] igbinary_015.phpt
[edit]
[-] __serialize_005.phpt
[edit]
[-] igbinary_087.phpt
[edit]
[-] igbinary_014.phpt
[edit]
[-] igbinary_082_php74.phpt
[edit]
[-] igbinary_063_php7.phpt
[edit]
[-] typed_property_ref_overwrite.phpt
[edit]
[-] igbinary_bug72134.phpt
[edit]
[-] igbinary_020.phpt
[edit]
[-] __serialize_020.phpt
[edit]
[-] igbinary_063_php72.phpt
[edit]
[-] igbinary_048.phpt
[edit]
[-] __serialize_016.phpt
[edit]
[-] igbinary_046d.phpt
[edit]
[-] __serialize_013.phpt
[edit]
[-] igbinary_069.phpt
[edit]
[-] __serialize_014_php8.phpt
[edit]
[-] igbinary_084.phpt
[edit]
[-] igbinary_092.phpt
[edit]
[-] igbinary_025b.phpt
[edit]
[-] igbinary_057.phpt
[edit]
[-] igbinary_043.phpt
[edit]
[-] igbinary_enums_2.phpt
[edit]
[-] igbinary_004.phpt
[edit]
[-] igbinary_067.phpt
[edit]
[-] __serialize_004.phpt
[edit]
[-] igbinary_028.phpt
[edit]
[-] __serialize_010.phpt
[edit]
[-] igbinary_081.phpt
[edit]
[-] igbinary_070.phpt
[edit]
[-] __serialize_016_php8.phpt
[edit]
[-] igbinary_085.phpt
[edit]
[-] igbinary_094.phpt
[edit]
[-] igbinary_009b.phpt
[edit]
[-] igbinary_068.phpt
[edit]
[-] igbinary_034.phpt
[edit]
[-] igbinary_enums_1.phpt
[edit]
[-] igbinary_086.phpt
[edit]
[-] igbinary_enums_3_php83.phpt
[edit]
[-] igbinary_046b.phpt
[edit]
[-] igbinary_075.phpt
[edit]
[-] __serialize_011.phpt
[edit]
[-] php82_suppress_dynamic_properties_warning.inc
[edit]
[-] igbinary_024.phpt
[edit]
[-] igbinary_045c.phpt
[edit]
[-] igbinary_079.phpt
[edit]
[-] igbinary_015c.phpt
[edit]
[-] __serialize_018.phpt
[edit]
[-] __serialize_012.phpt
[edit]
[-] igbinary_084b.phpt
[edit]
[-] igbinary_058b.phpt
[edit]
[-] igbinary_040.phpt
[edit]
[-] igbinary_066.phpt
[edit]
[-] igbinary_022.phpt
[edit]
[-] igbinary_027.phpt
[edit]
[-] igbinary_016.phpt
[edit]
[-] igbinary_046c.phpt
[edit]
[-] igbinary_023.phpt
[edit]
[-] typed_property_ref_overwrite2.phpt
[edit]
[-] igbinary_041.phpt
[edit]
[-] igbinary_099.phpt
[edit]
[-] igbinary_098.phpt
[edit]
[-] igbinary_026b.phpt
[edit]
[-] igbinary_031.phpt
[edit]
[-] igbinary_030_php72.phpt
[edit]
[-] igbinary_053.phpt
[edit]
[-] igbinary_017.phpt
[edit]
[-] __serialize_017.phpt
[edit]
[-] igbinary_001.phpt
[edit]
[-] igbinary_096.phpt
[edit]
[-] igbinary_050.phpt
[edit]
[-] igbinary_088.phpt
[edit]
[-] igbinary_065.phpt
[edit]
[-] igbinary_026_php8.phpt
[edit]
[-] igbinary_049b.phpt
[edit]
[-] igbinary_009b_php8.phpt
[edit]
[-] __serialize_001.phpt
[edit]
[-] igbinary_078.phpt
[edit]
[-] igbinary_091.phpt
[edit]
[-] igbinary_021.phpt
[edit]
[-] igbinary_enums_3.phpt
[edit]
[-] igbinary_071.phpt
[edit]
[-] igbinary_018.phpt
[edit]
[-] igbinary_029.phpt
[edit]
[-] igbinary_046.phpt
[edit]
[-] __serialize_007.phpt
[edit]
[-] igbinary_003.phpt
[edit]
[-] __serialize_008.phpt
[edit]
[-] igbinary_005.phpt
[edit]
[-] igbinary_095.phpt
[edit]
[-] igbinary_033.phpt
[edit]
[-] igbinary_047.phpt
[edit]
[-] igbinary_076.phpt
[edit]
[-] igbinary_089.phpt
[edit]
[-] igbinary_072.phpt
[edit]
[-] igbinary_049.phpt
[edit]
[-] igbinary_077.phpt
[edit]
[-] igbinary_015b.phpt
[edit]
[-] igbinary_002.phpt
[edit]
[-] igbinary_073.phpt
[edit]
[-] igbinary_048b.phpt
[edit]
[-] igbinary_012.phpt
[edit]
[-] __serialize_019.phpt
[edit]
[-] igbinary_062.phpt
[edit]
[-] __serialize_002.phpt
[edit]
[-] __serialize_015.phpt
[edit]
[-] igbinary_089_32bit.phpt
[edit]
[-] igbinary_008.phpt
[edit]
[-] typed_property_refs_php74.phpt
[edit]
[-] igbinary_064.phpt
[edit]
[-] igbinary_010.phpt
[edit]
[-] igbinary_074.phpt
[edit]
[-] typed_property_ref_assignment_failure.phpt
[edit]
[-] typed_property_refs.phpt
[edit]
[-] igbinary_052.phpt
[edit]
[-] igbinary_009.phpt
[edit]
[-] __serialize_003.phpt
[edit]
[-] igbinary_032.phpt
[edit]
[-] igbinary_bug54662.phpt
[edit]
[-] igbinary_007.phpt
[edit]
[-] igbinary_097.phpt
[edit]
[-] __serialize_006.phpt
[edit]
[-] igbinary_044.phpt
[edit]
[-] __serialize_021.phpt
[edit]
[-] igbinary_013.phpt
[edit]
[-] igbinary_071_php8.phpt
[edit]
[-] sleep_mangled_name_clash.phpt
[edit]
[-] igbinary_022_php82.phpt
[edit]
[-] igbinary_051.phpt
[edit]
[-] igbinary_045b.phpt
[edit]
[-] igbinary_055.phpt
[edit]
[-] igbinary_030_php7.phpt
[edit]
[-] igbinary_082.phpt
[edit]
[-] igbinary_080.phpt
[edit]
[-] __serialize_022.phpt
[edit]
[-] igbinary_025.phpt
[edit]
[-] __serialize_013_php8.phpt
[edit]
[-] igbinary_059.phpt
[edit]
[-] igbinary_054.phpt
[edit]
[-] igbinary_093.phpt
[edit]
[-] __serialize_009.phpt
[edit]
[-] igbinary_006.phpt
[edit]
[-] igbinary_026b_php8.phpt
[edit]
[-] igbinary_058.phpt
[edit]
[-] igbinary_083.phpt
[edit]
[-] __serialize_014.phpt
[edit]
[-] igbinary_026.phpt
[edit]
[-] igbinary_090.phpt
[edit]