Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues for php map when parsing missing key/value #6588

Merged
merged 1 commit into from Aug 29, 2019

Conversation

TeBoring
Copy link
Contributor

@TeBoring TeBoring commented Aug 29, 2019

  • For missing message value, map should create a default message
    instance in order to keep its invariable.
  • On 32-bit platform, int64 map key should be string

Integration test implemented in #6560, which will catch bugs fixed in this issue.

* For missing message value, map should create a default message
instance in order to keep its invariable.
* On 32-bit platform, int64 map key should be string
Copy link
Contributor

@stanley-cheung stanley-cheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small comment: is there a bug associated with this? Perhaps add a test to remind us what this will fix?

// For MapEntry, getValue should always return a valid value. Thus, we
// need to create a default instance value if the value type is
// message, in case no value is provided in data.
$value_field = $desc->getFieldByNumber(2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the number 2 here specifically?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Map entry only has key (1) and value (2) field.
Besides, only value field can be message type.

@TeBoring
Copy link
Contributor Author

TeBoring commented Aug 29, 2019

Integration test implemented in #6560, which will catch bugs fixed in this issue.
However, I want to separate the fix for php out.

@stanley-cheung
Copy link
Contributor

Thanks LGTM

@TeBoring TeBoring merged commit 342ae0e into protocolbuffers:master Aug 29, 2019
@TeBoring TeBoring deleted the php-fix branch August 29, 2019 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants