Open betashepherd opened 10 years ago
It would be helpful if you could paste the proto file and the PHP code in question.
pbtest.php
<?php
require_once 'autoload.php';
$list_request = new el\ListRequest ();
$list_request->setRankType ( 6 ); $list_request->setCheckInDate ( time () + 86400 * 1 ); $list_request->setCheckOutDate ( time () + 86400 * 2 ); $list_request->setRegionId ( 180027 );
$as_request = new el\AsRequest(); $as_request->setSearchType(2); $as_request->setListReq($list_request); $request_body = $as_request->serializeToString();
$head = pack ( "nnIa16III", 1, 1, 1, "abc", 1, 0, strlen ( $request_body ) );
$host = '192.168.1.1'; $port = 1900; $socket = socket_create ( AF_INET, SOCK_STREAM, SOL_TCP ); socket_connect ( $socket, $host, $port ); socket_write ( $socket, $head, strlen($head)); socket_write ( $socket, $request_body, strlen($request_body));
$response_head = socket_read($socket, strlen($head), PHP_BINARY_READ); $head_data = unpack ( "n/n/I/a16/I/I/Ibody_len", $response_head);
$body_len = $head_data['body_len'];
if($body_len !== 0) { $response_body = socket_read($socket, $body_len, PHP_BINARY_READ);
//this line cause the error
//Fatal error: Uncaught exception 'ProtocolBuffersInvalidProtocolBufferException' with message 'passed variable contains malformed byte sequence. or it contains unsupported tag' in /usr/local/php/protoc-gen-php/interface/pb/pbtest.php:34
$response_data = el\AsResponse::parseFromString($response_body);
} else { print 'null response'; }
el\AsResponse::parseFromString($response_body);
hi, Shuhei, I have already send you an email, the title is "php-protocolbuffers error : https://github.com/chobie/php-protocolbuffers/issues/45"
Fatal error: Uncaught exception 'ProtocolBuffersInvalidProtocolBufferException' with message 'passed variable contains malformed byte sequence. or it contains unsupported tag'
I have got a problem. This error occur with no rule, sometimes it happen.
[root@lnx-search-14-228 pb]# php pbtest.php
Fatal error: Uncaught exception 'ProtocolBuffersInvalidProtocolBufferException' with message 'passed variable contains malformed byte sequence. or it contains unsupported tag' in /usr/local/php/protoc-gen-php/interface/pb/pbtest.php:34 Stack trace:
0 /usr/local/php/protoc-gen-php/interface/pb/pbtest.php(34): ProtocolBuffersMessage::parseFromString('\x08\x91\x85\x80\x80\xC0\xD2\x86\xF1\xF3\x01\x1A\xF7)\x18...')
1 {main}
thrown in /usr/local/php/protoc-gen-php/interface/pb/pbtest.php on line 34 [root@lnx-search-14-228 pb]# php pbtest.php error occured [root@lnx-search-14-228 pb]# vim pbtest.php [root@lnx-search-14-228 pb]# php pbtest.php
Fatal error: Uncaught exception 'ProtocolBuffersInvalidProtocolBufferException' with message 'passed variable contains malformed byte sequence. or it contains unsupported tag' in /usr/local/php/protoc-gen-php/interface/pb/pbtest.php:34 Stack trace:
0 /usr/local/php/protoc-gen-php/interface/pb/pbtest.php(34): ProtocolBuffersMessage::parseFromString('\x08\x93\x85\x80\x80\xC0\xD2\x86\xF1\xF3\x01\x1A\xF7)\x18...')
1 {main}
thrown in /usr/local/php/protoc-gen-php/interface/pb/pbtest.php on line 34