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

Added support for "==" to the PHP C extension #7883

Merged
merged 1 commit into from Sep 14, 2020

Conversation

haberman
Copy link
Member

Prior to this CL, the == operator in PHP worked as expected for the pure-PHP library, but not for the C extension.

This PR fixes the C extension to have proper == semantics. It also adds tests that pass for both pure-PHP and the C extension.

Fixes: #7650

$m2->getMapInt32Message()[1]->setA(1234);
$this->assertTrue($m1 != $m2);

# TODO: what about unknown fields?
Copy link
Contributor

Choose a reason for hiding this comment

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

Question, is equal only recommend for test? If so, I think we don't need to worry about it.
Otherwise, I think not comparing equal ensures backward compatibility.

@haberman
Copy link
Member Author

I think I'll submit this for now and address the unknown field issue in a follow-up.

@haberman haberman merged commit f0942fb into protocolbuffers:master Sep 14, 2020
vesavlad pushed a commit to vesavlad/protobuf that referenced this pull request Sep 22, 2020
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 equality comparison between messages always returns true
4 participants