Background because protocolbuffers is being used in the project, all the extensions used in the project basically support php7. only protocolbuffers does not support php7. the original author has stopped maintaining the extension, instead, you can only start to study how to extend protocolbuffers. x... background
Because protocolbuffers is being used in the project, the extensions used in the entire project basically support php7. only protocolbuffers does not support php7, and the original author has stopped maintaining the extension, instead, you can only start to study how to extend protocolbuffers. upgrade PHP 7 to version x. Currently, this extension can be compiled. Github
The result of make test is 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 result is 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)}
Conclusion: in protocolbuffers: decode, the parsed object can be returned, but the object attributes cannot be read. Solving...
Reply content: Background
Because protocolbuffers is being used in the project, the extensions used in the entire project basically support php7. only protocolbuffers does not support php7, and the original author has stopped maintaining the extension, instead, you can only start to study how to extend protocolbuffers. upgrade PHP 7 to version x. Currently, this extension can be compiled. Github
The result of make test is 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 result is 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)}
Conclusion: in protocolbuffers: decode, the parsed object can be returned, but the object attributes cannot be read. Solving...