Skip to content

Fixed clone for Message, RepeatedField, and MapField.#8245

Merged
haberman merged 1 commit intoprotocolbuffers:masterfrom
haberman:php-clone
Feb 2, 2021
Merged

Fixed clone for Message, RepeatedField, and MapField.#8245
haberman merged 1 commit intoprotocolbuffers:masterfrom
haberman:php-clone

Conversation

@haberman
Copy link
Member

@haberman haberman commented Feb 1, 2021

Also updated the code to use a TypeInfo struct for convenient
passing of type and desc together. This simplified a lot of code
and made this change easier to write.

Fixes #8233

Also updated the code to use a TypeInfo struct for convenient
passing of type and desc together. This simplified a lot of code
and made this change easier to write.
Copy link
Contributor

@gerben-s gerben-s left a comment

Choose a reason for hiding this comment

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

What exactly went wrong and how does this fix it?

@haberman
Copy link
Member Author

haberman commented Feb 2, 2021

@gerben-s see the attached bug: #8233

This PR fixes the problem by implementing the clone_obj handler for Message, RepeatedField, and MapField. clone_obj is a function pointer that we give to the PHP interpreter, PHP will call it when a user writes clone $msg.

@haberman haberman merged commit f3e53a0 into protocolbuffers:master Feb 2, 2021
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.

PHP protobuf extension crashes after cloning a protobuf object

3 participants