I'm attempting to parse protobufs from Bazel's Build Event Protocol (format described here). I can successfully parse these protobufs using Java or Python, but my attempts at doing so with PHP have been met with the following exception:
Google\Protobuf\Internal\GPBDecodeException: Error occurred during parsing: Unexpected EOF inside message. in .../vendor/google/protobuf/php/src/Google/Protobuf/Internal/Message.php on line 292
This leads me to believe that there may be a bug in the PHP protobuf implementation. I am using 3.3.0 of google/protobuf (from composer).
In order to make a simple example of this problem, I've isolated a single protobuf message from a Bazel output file and saved it as a separate file (no delimiter or varint length encoding). This sample data file (single.msg) as well as my PHP and Python scripts can be found at this gist.
I just ran into the same issue myself. I was porting my Python protobuf code to PHP. I'm also using 3.3.0 from composer.
I managed to duplicate the error with your example also. Can someone please help to solve this issue or shed some light what might be wrong.
I finally figured out what my problem is, and I see it's the same you have.
The cause of the Unexpected EOF in message is missing fields defined in the proto file.
In this case, some BuildEventId children have fields not defined in build_event_stream.proto (tags 11, 12, 14).
Python and Protoc has no problems parsing unknown fields.
The PHP version should also be able to parse those same unknown fields and not throw an exeption.
Could you try master? I remember there was some logic added to handle unknown fields.
Feel free to reopen this issue if there is still problem.
Most helpful comment
I finally figured out what my problem is, and I see it's the same you have.
The cause of the Unexpected EOF in message is missing fields defined in the proto file.
In this case, some BuildEventId children have fields not defined in build_event_stream.proto (tags 11, 12, 14).
Python and Protoc has no problems parsing unknown fields.
The PHP version should also be able to parse those same unknown fields and not throw an exeption.