protocolbuffers / protocolbuffers/protobuf
PHP: better debug info for Message objects in protobuf C-extension
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 72k
- Forks
- 16.3k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 140
Description
See https://github.com/protocolbuffers/protobuf/issues/12714 and https://github.com/protocolbuffers/protobuf/pull/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:
// Calling var_dump on a Protobuf message (extension enabled):
php > $timestamp = new Google\Protobuf\Timestamp();
php > $timestamp->setSeconds(12345);
php > var_dump($timestamp);
object(Google\Protobuf\Timestamp)#1 (0) {
}
Ideally this would output something like this:
object(Google\Protobuf\Timestamp)#12 (1) {
["seconds"]=>
int(12345)
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading issue 12714 and pull request 12718, then reproduce the shown var_dump behavior with the PHP C-extension and a populated Google\Protobuf\Timestamp. Done means Message objects expose useful field values in var_dump output, matching the demonstrated seconds example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100