You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by "sveneld (via GitHub)" <gi...@apache.org> on 2026/09/03 08:09:58 UTC
[PR] THRIFT-3874: Add PHP wakeup serializer regression coverage [thrift]
sveneld opened a new pull request, #3795:
URL: https://github.com/apache/thrift/pull/3795
## Summary
- add a PHP integration regression test for a generated class that survives PHP `serialize()` / `unserialize()`
- verify the restored object still round-trips through `TBinarySerializer`
- lock in the current generator/runtime behavior that keeps generated type metadata usable after wakeup
## Testing
- `docker run --rm -v /home/v.panivko/github/thrift:/thrift -w /thrift thrift-php-dev:local vendor/bin/phpunit -c lib/php/phpunit.xml lib/php/test/Integration/Lib/Serializer/BinarySerializerTest.php`
Generated-by: OpenAI Codex GPT-5 <no...@openai.com>
--
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: notifications-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] THRIFT-3874: Add PHP wakeup serializer regression coverage [thrift]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3795:
URL: https://github.com/apache/thrift/pull/3795#discussion_r3943486383
##########
lib/php/test/Integration/Lib/Serializer/BinarySerializerTest.php:
##########
@@ -43,4 +43,20 @@ 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));
+ $this->assertEquals($struct, $restored);
+
+ // Guard THRIFT-3874: generated PHP classes must keep their type
+ // metadata usable after PHP wakeup/unserialize.
+ $serialized = TBinarySerializer::serialize($restored, '\\Basic\\ThriftTest\\Xtruct');
+ $deserialized = TBinarySerializer::deserialize($serialized, '\\Basic\\ThriftTest\\Xtruct');
Review Comment:
The PHP serialize()/unserialize() round-trip should be explicit and type-safe (unserialize() can return false and should restrict allowed_classes). Also, TBinarySerializer::serialize() only accepts the object argument, so the extra class-name parameter should be removed (it appears twice in this file).
--
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: notifications-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] THRIFT-3874: Add PHP wakeup serializer regression coverage [thrift]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] THRIFT-3874: Add PHP wakeup serializer regression coverage [thrift]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3795:
URL: https://github.com/apache/thrift/pull/3795#discussion_r3944226213
##########
lib/php/test/Integration/Lib/Serializer/BinarySerializerTest.php:
##########
@@ -39,8 +39,24 @@ class BinarySerializerTest extends TestCase
public function testBinarySerializer()
{
$struct = new \Basic\ThriftTest\Xtruct(['string_thing' => 'abc']);
- $serialized = TBinarySerializer::serialize($struct, '\\Basic\\ThriftTest\\Xtruct');
+ $serialized = TBinarySerializer::serialize($struct);
$deserialized = TBinarySerializer::deserialize($serialized, '\\Basic\\ThriftTest\\Xtruct');
$this->assertEquals($struct, $deserialized);
Review Comment:
Use the ::class constant instead of a manually escaped class-name string when calling deserialize(); it’s less error-prone and consistent with the PHP unit tests (e.g., TBinarySerializerTest) that pass Foo::class.
This issue also appears on line 57 of the same file.
--
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: notifications-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] THRIFT-3874: Add PHP wakeup serializer regression coverage [thrift]
Posted by "sveneld (via GitHub)" <gi...@apache.org>.
sveneld merged PR #3795:
URL: https://github.com/apache/thrift/pull/3795
--
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: notifications-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org