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

data parse error #45

Open
betashepherd opened this issue Jul 24, 2014 · 4 comments
Open

data parse error #45

betashepherd opened this issue Jul 24, 2014 · 4 comments

Comments

@betashepherd
Copy link

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

@dcelasun
Copy link
Contributor

It would be helpful if you could paste the proto file and the PHP code in question.

@betashepherd
Copy link
Author

pbtest.php

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'; }

@betashepherd
Copy link
Author

el\AsResponse::parseFromString($response_body);

@betashepherd
Copy link
Author

hi, Shuhei, I have already send you an email, the title is "php-protocolbuffers error : #45"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants