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

PHP: Call to a member function getField() on a non-object #2433

Closed
rmanig opened this issue Dec 2, 2016 · 2 comments
Closed

PHP: Call to a member function getField() on a non-object #2433

rmanig opened this issue Dec 2, 2016 · 2 comments

Comments

@rmanig
Copy link

rmanig commented Dec 2, 2016

my proto file:

syntax = "proto3";

message Coordinates {
    sint32 lat = 1;
    sint32 lon = 2;
}

my code:

require_once __DIR__ . '/vendor/autoload.php';
require_once 'protobuf/Coordinates.pb.php';

$x = new Coordinates();

PHP 5.5.38 (homebrew), MacOSX El Capitan

I'm getting the following errors:

Notice: Undefined index: Coordinates in /Users/robert/PhpstormProjects/test_script/vendor/google/protobuf/php/src/Google/Protobuf/Internal/DescriptorPool.php on line 109

Call Stack:
PHP Notice:  Undefined index: Coordinates in /Users/robert/PhpstormProjects/test_script/vendor/google/protobuf/php/src/Google/Protobuf/Internal/DescriptorPool.php on line 109
    0.0491     492152   1. {main}() /Users/robert/PhpstormProjects/test_script/script.php:0
    0.1427    2026768   2. Google\Protobuf\Internal\Message->__construct(???) /Users/robert/PhpstormProjects/test_script/script.php:21
PHP Stack trace:
    0.1427    2026896   3. Google\Protobuf\Internal\DescriptorPool->getDescriptorByClassName(???) /Users/robert/PhpstormProjects/test_script/vendor/google/protobuf/php/src/Google/Protobuf/Internal/Message.php:74


Fatal error: Call to a member function getField() on a non-object in /Users/robert/PhpstormProjects/test_script/vendor/google/protobuf/php/src/Google/Protobuf/Internal/Message.php on line 75
PHP   1. {main}() /Users/robert/PhpstormProjects/test_script/script.php:0
PHP   2. Google\Protobuf\Internal\Message->__construct($desc = *uninitialized*) /Users/robert/PhpstormProjects/test_script/script.php:21
PHP   3. Google\Protobuf\Internal\DescriptorPool->getDescriptorByClassName($klass = *uninitialized*) /Users/robert/PhpstormProjects/test_script/vendor/google/protobuf/php/src/Google/Protobuf/Internal/Message.php:74

PHP Fatal error:  Call to a member function getField() on a non-object in /Users/robert/PhpstormProjects/test_script/vendor/google/protobuf/php/src/Google/Protobuf/Internal/Message.php on line 75
PHP Stack trace:
PHP   1. {main}() /Users/robert/PhpstormProjects/test_script/script.php:0
PHP   2. Google\Protobuf\Internal\Message->__construct($desc = *uninitialized*) /Users/robert/PhpstormProjects/test_script/script.php:21
Call Stack:
    0.0491     492152   1. {main}() /Users/robert/PhpstormProjects/test_script/script.php:0
    0.1427    2026768   2. Google\Protobuf\Internal\Message->__construct(???) /Users/robert/PhpstormProjects/test_script/script.php:21

Process finished with exit code 255

What am I doing wrong here?

@TeBoring
Copy link
Contributor

TeBoring commented Dec 2, 2016

Could you test against master head?
This occurred when there is no namespace, which should have been fixed.

@rmanig
Copy link
Author

rmanig commented Dec 5, 2016

master branch worked, but dev-master didnt include the fix, see #2440

@rmanig rmanig closed this as completed Dec 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants