-
Notifications
You must be signed in to change notification settings - Fork 15.5k
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
PHP package error #3182
Comments
any fixes yet? having the same problem here. |
Does rename the message using first-upper camel case fix the problem? |
in my case, i already have the message using camel case:
|
|
Okay, the underscores confuse me on that. |
A first-upper camel case should be |
That worked. Thanks |
Awesome. |
PHP VERSION 7.1.5
libprotoc 3.3.0
the common.proto file
`syntax = "proto3";
message requestHeader
{
uint32 api = 1;
string version = 10;
string vkey = 11;
uint32 vmid = 12;
}`
the loadInit.proto file
`syntax = "proto3";
package system;
import "common.proto";
message loadInitRequest
{
message parameter
{
string SToken = 1;
}
requestHeader header = 1;
parameter param = 2; //SToken
}`
and generate code
protoc --proto_path=proto/ --php_out=gen/ proto/common.proto proto/loadInit.proto
the composer.json file
{ "name": "TP", "description": "test protobuf", "type": "project", "autoload": { "psr-4": { "Google\\Protobuf\\Internal\\": "vendor/protobuf/Google/Protobuf/Internal", "GPBMetadata\\Google\\Protobuf\\Internal\\": "vendor/protobuf/GPBMetadata/Google/Protobuf/Internal", "GPBMetadata\\" : "gen/GPBMetadata/", "System\\" : "gen/System" }, "files": [ "vendor/protobuf/Google/Protobuf/descriptor.php" ] } }
then try to run following php code:
`include DIR.'/vendor/autoload.php';
$req = new System\loadInitRequest();
var_dump($req);`
get following error:
Notice: Undefined index: System\loadInitRequest in /media/sf_wwwroot/test/vendor/protobuf/Google/Protobuf/Internal/DescriptorPool.php on line 112
Fatal error: Uncaught Error: Call to a member function getField() on null in /media/sf_wwwroot/test/vendor/protobuf/Google/Protobuf/Internal/Message.php:75 Stack trace: #0 /media/sf_wwwroot/test/gen/System/loadInitRequest.php(31): Google\Protobuf\Internal\Message->__construct() #1 /media/sf_wwwroot/test/index.php(4): System\loadInitRequest->__construct() #2 {main} thrown in /media/sf_wwwroot/test/vendor/protobuf/Google/Protobuf/Internal/Message.php on line 75
The text was updated successfully, but these errors were encountered: