Fatal error: Uncaught exception 'ProtocolBuffersInvalidProtocolBufferException' with message 'passed variable contains malformed byte sequence. or it contains unsupported tag' in C:\Users\x3.mbetzel\Development\workspaces\php\ProtoBufGen\src\protocolbuffers\Compiler.php on line 186
ProtocolBuffersInvalidProtocolBufferException: passed variable contains malformed byte sequence.
Enviroment:
Windows 7 64 bit
PHP 5.5.14-nts-Win32-VC11-x86
php_protocolbuffers.dll version 0.26 alpha PECL
php_proto_gen GITHUB master
Trying to generate proto.php file from .proto file :
package test_package;
message Person
{
required int32 user_id = 1;
optional string name = 2;
}
use protocolbuffers\Autoloader;
Autoloader::register();
use protocolbuffers\generator\php\Generator;
use protocolbuffers\Compiler;
use protocolbuffers\GeneratorContext;
Fatal error: Uncaught exception 'ProtocolBuffersInvalidProtocolBufferException' with message 'passed variable contains malformed byte sequence. or it contains unsupported tag' in C:\Users\x3.mbetzel\Development\workspaces\php\ProtoBufGen\src\protocolbuffers\Compiler.php on line 186 ProtocolBuffersInvalidProtocolBufferException: passed variable contains malformed byte sequence. Enviroment: Windows 7 64 bit PHP 5.5.14-nts-Win32-VC11-x86 php_protocolbuffers.dll version 0.26 alpha PECL php_proto_gen GITHUB master
Trying to generate proto.php file from .proto file :
package test_package;
message Person { required int32 user_id = 1; optional string name = 2; }
CODE:
<?php
require_once 'proto/autoload.php'; require_once 'src/protocolbuffers/Autoloader.php';
use protocolbuffers\Autoloader; Autoloader::register(); use protocolbuffers\generator\php\Generator; use protocolbuffers\Compiler; use protocolbuffers\GeneratorContext;
//$path = "tests" . DIRECTORY_SEPARATOR . "fixtures" . DIRECTORY_SEPARATOR . "simple.bin"; $path = "tests" . DIRECTORY_SEPARATOR . "proto" . DIRECTORY_SEPARATOR . "person.proto"; $stdin = stream_get_contents(fopen($path,'r')); $compiler = new Compiler(); $response = $compiler->compile($stdin); var_dump($response);
simple.bin works as it produces a proto.php file as third string in array (file[2]).