Protocol-buffer-protocolbuffers extension upgrade to PHP7 problems encountered?

Source: Internet
Author: User

Background

Because Protocolbuffers is being used in the project, the extension used throughout the project has basically been supported by PHP7, and only protocolbuffers this does not support PHP7, the original author has stopped maintaining the extension, But I can only begin to study how to upgrade the 5.x version of the protocolbuffers extension to PHP7. Currently the extension can be compiled. GitHub

The make test results are as follows:

Number of tests :  144               144Tests skipped   :    0 (  0.0%) --------Tests warned    :    0 (  0.0%) (  0.0%)Tests failed    :   67 ( 46.5%) ( 46.5%)Expected fail   :    0 (  0.0%) (  0.0%)Tests passed    :   77 ( 53.5%) ( 53.5%)

Problems encountered

The following is the test code:


  
   setValue(0);$obj = ProtocolBuffers::decode("Tutorial_Integer32", $bytes);var_dump($obj);if ($obj instanceof Tutorial_Integer32) {    var_dump($obj->getValue());    if ($obj->getValue() == 0) {        echo "OK" . PHP_EOL;    } else {        var_dump($obj);    }} else {    var_dump($obj);}ini_set("protocolbuffers.native_scalars", 1);$obj = ProtocolBuffers::decode("Tutorial_Integer32", $bytes);if ($obj instanceof Tutorial_Integer32) {    var_dump($obj->getValue());    if ($obj->getValue() === 0) {        echo "OK" . PHP_EOL;    } else {        var_dump($obj);    }} else {    var_dump($obj);}

The output results are as follows:

object(Tutorial_Integer32)#2 (2) {  ["_properties":protected]=>  array(0) {  }  ["value":protected]=>  string(1) "0"}NULLOKNULLobject(Tutorial_Integer32)#3 (2) {  ["_properties":protected]=>  array(0) {  }  ["value":protected]=>  int(0)}

Summary of the problem: when Protocolbuffers::d Ecode, the parsed object can be returned, but the object's properties cannot be read. Solution in ...

Reply content:

Background

Because Protocolbuffers is being used in the project, the extension used throughout the project has basically been supported by PHP7, and only protocolbuffers this does not support PHP7, the original author has stopped maintaining the extension, But I can only begin to study how to upgrade the 5.x version of the protocolbuffers extension to PHP7. Currently the extension can be compiled. GitHub

The make test results are as follows:

Number of tests :  144               144Tests skipped   :    0 (  0.0%) --------Tests warned    :    0 (  0.0%) (  0.0%)Tests failed    :   67 ( 46.5%) ( 46.5%)Expected fail   :    0 (  0.0%) (  0.0%)Tests passed    :   77 ( 53.5%) ( 53.5%)

Problems encountered

The following is the test code:


  
   setValue(0);$obj = ProtocolBuffers::decode("Tutorial_Integer32", $bytes);var_dump($obj);if ($obj instanceof Tutorial_Integer32) {    var_dump($obj->getValue());    if ($obj->getValue() == 0) {        echo "OK" . PHP_EOL;    } else {        var_dump($obj);    }} else {    var_dump($obj);}ini_set("protocolbuffers.native_scalars", 1);$obj = ProtocolBuffers::decode("Tutorial_Integer32", $bytes);if ($obj instanceof Tutorial_Integer32) {    var_dump($obj->getValue());    if ($obj->getValue() === 0) {        echo "OK" . PHP_EOL;    } else {        var_dump($obj);    }} else {    var_dump($obj);}

The output results are as follows:

object(Tutorial_Integer32)#2 (2) {  ["_properties":protected]=>  array(0) {  }  ["value":protected]=>  string(1) "0"}NULLOKNULLobject(Tutorial_Integer32)#3 (2) {  ["_properties":protected]=>  array(0) {  }  ["value":protected]=>  int(0)}

Summary of the problem: when Protocolbuffers::d Ecode, the parsed object can be returned, but the object's properties cannot be read. Solution in ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.