Copilot commented on code in PR #3795:
URL: https://github.com/apache/thrift/pull/3795#discussion_r3940729010
##########
lib/php/test/Integration/Lib/Serializer/BinarySerializerTest.php:
##########
@@ -43,4 +43,19 @@ public function testBinarySerializer()
$deserialized = TBinarySerializer::deserialize($serialized,
'\\Basic\\ThriftTest\\Xtruct');
$this->assertEquals($struct, $deserialized);
}
+
+ public function testBinarySerializerAfterPhpUnserialize(): void
+ {
+ $struct = new \Basic\ThriftTest\Xtruct(['string_thing' => 'abc']);
+
+ /** @var \Basic\ThriftTest\Xtruct $restored */
+ $restored = unserialize(serialize($struct));
+
Review Comment:
The test claims to cover the object surviving PHP serialize()/unserialize(),
but it never asserts that the wakeup result still matches the original object.
If unserialize() returned an incomplete/incorrect object, the round-trip
assertion could still pass against the already-broken state. Add an explicit
assertion that $restored equals $struct (and optionally assert the restored
type) before exercising TBinarySerializer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]