[PHP-BUG] Bug #74962 [NEW]: protobuf extension bug

[email protected] ("roczpwu at gmail dot com") Fri, 21 Jul 2017 09:42:41 GMT
Newsgroups php.standards
Message-ID <[email protected]>
From:             roczpwu at gmail dot com
Operating system: mac osx
PHP version:      7.1.7
Package:          PHP Language Specification
Bug Type:         Bug
Bug description:protobuf extension bug

Description:
------------
I generate php files using my pro file, when I invoke serializeToString
method, Segment fault: 11 error occurred.

Test script:
---------------
proto file:
syntax = "proto3";
package com;
message A
{
    string str = 1;
}
message B
{
    A a = 307001;
    string json_body_req = 308000;
}

===================================
php test file:
<?php
$b = new \Com\B();
$a = new \Com\A();
$a->setStr("hello");
$b->setJsonBodyReq("world");
$b->setA($a);
$str = $b->serializeToString();

$b = new \Com\B();
$b->mergeFromString($str);
var_dump($b->getA()->getStr());

Expected result:
----------------
string(5) "hello"

Actual result:
--------------
Segmentation fault: 11

-- 
Edit bug report at https://bugs.php.net/bug.php?id=74962&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=74962&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=74962&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=74962&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=74962&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=74962&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=74962&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=74962&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=74962&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=74962&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=74962&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=74962&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=74962&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=74962&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74962&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=74962&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=74962&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=74962&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74962&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=74962&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=74962&r=mysqlcfg