-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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: better debug info for Message objects in protobuf C-extension #14872
Comments
A similar problem. Checked on protobuf 3.12.4, 3.17, 3.24.4
php -v
|
@northmule what is the problem you're seeing? For clarification, this issue is a feature request for the extension to produce better debugging info. It has not yet been implemented. |
The problem is that when connecting the .so library in the php.ini file, the ability to view the class object inherited from the parent class \Google\Protobuf\Internal\Message disappears. The library is connected here
The library is not connected here
I highlighted the object in red. If the library is not connected, I can view the object, it is filled with data If the library is connected, I cannot view the object. For simplicity, I took the \Google\Protobuf\Timestamp class, but this is reproduced on any other object from any class with inheritance from \Google\Protobuf\Internal\Message |
I assume this is because in the first example, the object is implemented in the C extension, and so is not visible by the IDE. This feature request is to implement a hook in the message class implemented in C++ which, similar to |
I think this is a reasonable feature request, and we'd be happy to accept a contribution. This would involve implementing There was previously a PR to return an empty hash table for |
I just noticed that we have a test for debug info that is disabled for the C extension: protobuf/php/tests/DebugInfoTest.php Lines 37 to 42 in 6f1d881
So we essentially already have a spec for how the C extension should work in this regard. |
@haberman This isn't a justification for the existing behavior, it's just confirming that it isn't currently supported. I added that test (and the feature). It was required to skip since this hasn't been implemented in the C extension yet. See #12718 EDIT: I think I misunderstood your comment to mean this was WAD, but after rereading it, I think you're just saying that the C-extension's implementation can follow the "spec" of the native implementation (and pass the tests), and I totally agree. Sorry for the confusion. |
Exactly. I meant it as a hint/pointer for whoever ends up implementing this for C. The easiest way to start is to re-enable the test, and code a solution until the test passes. |
See #12714 and #12718, which resolved this problem for the native library.
When the protobuf c-extension is enabled for PHP, calling
var_dump
on a protobuf message object does not output any useful information:Ideally this would output something like this:
The text was updated successfully, but these errors were encountered: