From 7eaba94a31c2f18985cc4bc77d286dcb98d3919b Mon Sep 17 00:00:00 2001 From: Denis Brumann Date: Fri, 24 Jul 2020 12:09:10 +0200 Subject: [PATCH] Ignores test for PHP 7.2+ The offending test breaks due to a representation change in the deserialized (incomplete) object and can safely be ignored. --- tests/UnserializeTest.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/UnserializeTest.php b/tests/UnserializeTest.php index e9adfb3..031456f 100644 --- a/tests/UnserializeTest.php +++ b/tests/UnserializeTest.php @@ -232,6 +232,26 @@ public function test_double_unserialize_double_serialized() $this->assertInstanceOf('__PHP_Incomplete_Class', $unserialized); } + /** + * @requires PHP < 7.2 + * + * In PHP 7.2+ the unserialized, incomplete object is not a stdClass object. + * + * That means instead of: + * + * stdClass Object &000000007bdb046700000000047a45c3 ( + * 'value' => 'a:2:{i:0;s:4:"item";i:1;O:8:"stdClass":1:{s:5:"value";s:12:"s:5:"inner";";}}' + * ) + * + * We get: + * + * __PHP_Incomplete_Class Object &000000007bdb047d00000000047a45c3 ( + * '__PHP_Incomplete_Class_Name' => 'stdClass' + * 'value' => 'a:2:{i:0;s:4:"item";i:1;O:8:"stdClass":1:{s:5:"value";s:12:"s:5:"inner";";}}' + * ) + * + * We do not care about this changed representation and ignore this test instead for these versions. + */ public function test_nested_serialized_object_in_serialized_object_can_be_deserialized() { $inner = new \stdClass(); @@ -243,7 +263,7 @@ public function test_nested_serialized_object_in_serialized_object_can_be_deseri $unserialized = Unserialize::unserialize($serialized, $options); - $this->assertEquals($outer,$unserialized); + $this->assertEquals($outer, $unserialized); } public function test_string_containing_serialized_literals_can_be_deserialized()