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

PHP: Protocol Buffer "number" in PHP does not conform to protobuf spec #8114

Closed
bshaffer opened this issue Dec 2, 2020 · 2 comments · Fixed by #8235
Closed

PHP: Protocol Buffer "number" in PHP does not conform to protobuf spec #8114

bshaffer opened this issue Dec 2, 2020 · 2 comments · Fixed by #8235
Assignees
Labels

Comments

@bshaffer
Copy link
Contributor

bshaffer commented Dec 2, 2020

The proto3 spec, the maximum field number allowed is 2^29-1. In the PHP code, this number is being limited to 2147483647 >> 3, or 2^28-1.

As a result, the serialization of any proto field with a field number greater than 2^28-1 is failing when using the PHP protobuf native library and extension.

message TestMessage {
  string description = 456214797;
}
// serialize
$message = new TestMessage();
$message->setDescription('this string will not be serialized');
$serializedMessage = $message->serializeToString();

// unserialize
$message2 = new TestMessage();
$message2->mergeFromString($serializedMessage);
var_dump($message2->getDescription());
// outputs an empty string ('')
@vam-google
Copy link

@TeBoring Any updates on this?

@haberman
Copy link
Member

This is fixed in #8235

vam-google added a commit to vam-google/googleapis-discovery that referenced this issue May 3, 2021
…mber.

This is a rollback of googleapis/disco-to-proto3-converter#16, which became possible after protobuf fixed the original issue protocolbuffers/protobuf#8114
vam-google added a commit to googleapis/googleapis-discovery that referenced this issue May 3, 2021
…mber. (#31)

This is a rollback of googleapis/disco-to-proto3-converter#16, which became possible after protobuf fixed the original issue protocolbuffers/protobuf#8114
yoshi-automation added a commit to googleapis/python-compute that referenced this issue May 9, 2021
…mber.

This is a rollback of googleapis/disco-to-proto3-converter#16, which became possible after protobuf fixed the original issue protocolbuffers/protobuf#8114

Source-Author: Vadym Matsishevskyi <25311427+vam-google@users.noreply.github.com>
Source-Date: Mon May 3 13:01:13 2021 -0700
Source-Repo: googleapis/googleapis-discovery
Source-Sha: f9ff15d0795983956c1f94ec544176b257df31d1
Source-Link: googleapis/googleapis-discovery@f9ff15d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants