allegro / php-protobuf

PHP Protobuf - Google's Protocol Buffers for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"'span' field wire type non match" error when running protoc-gen-php.php

linpc opened this issue · comments

My Env:

OS: Mac OS 10.11.6
libprotoc-2.6.1
php-5.5.38

After cloning from git, running composer install, and trying sample .proto file in the readme, I encountered an error.

$ cat foo.proto
message Foo
{
    required int32 bar = 1;
    optional string baz = 2;
    repeated float spam = 3;
}

$ php protoc-gen-php.php foo.proto
ERROR: Unable to parse a message passed by protoc.
                                                  : parse error - "'span' field wire type is length-delimited but should be varint".
--php_out: protoc-gen-php: Plugin failed with status code 1.
ERROR: protoc exited with an exit status 1 when executed with:
  protoc \
    --plugin=protoc-gen-php='/Users/me/src/php-protobuf/protoc-gen-php.php' \
    --php_out=':./' \
    'foo.proto'

I also tried the releaeae tag v0.11.1, but still the same, any hint to solve this?

I am got thats error too.

libprotoc-2.6.0
ubuntu 14.04 LTS
php 5.5.9

I'm not able to reproduce this error. The only reason for this error I can think of is having loaded older version of the extension while using the newest compiler.

yeah,that`s right,I recompile the extension,and it worked

@huoshaonan great, thanks for confirmation!