Repository navigation
THRIFT-796: Do not change field types in thrift_protocol_write_binary - #4160
Open
slachiewicz wants to merge 1 commit into
Open
slachiewicz wants to merge 1 commit into
slachiewicz wants to merge 1 commit into
Conversation
Client: php binary_serialize() ran convert_to_long/string/double/array directly on the zval of the caller's property, so serializing a struct turned an int field holding "100" into 100 (and the reverse). The conversion now runs on a copy that is released on scope exit; the wire output is the same. Covered by a phpt in the extension and a PHPUnit test in TBinaryProtocolAcceleratedTest. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: THRIFT-796
The C extension's
thrift_protocol_write_binaryranconvert_to_long/string/double/arraydirectly on the zval of the caller's struct property, so serializing a struct changed the field's PHP type: ani32field holding"100"came back as100, and the reverse for strings. The conversion now runs on a copy that is released on scope exit; the bytes on the wire are unchanged.The PHPUnit test skips itself when the extension is not loaded, and the
lib-phpjob runs PHPUnit without it, so CI covers this only once #4122 (THRIFT-6515) loads the extension in that job.Verified: with the extension built from this branch,
tests/argument_not_mutated.phptpasses andTBinaryProtocolAcceleratedTestpasses 7 of 7 (PHP_INI_SCAN_DIRloading the extension, sincephpunit.xmluses process isolation); built from master, the new test fails with100 !== "100". phpcs clean.