protocolbuffers/protobuf

PHP: better debug info for Message objects in protobuf C-extension

Open

#14,872 建立於 2023年11月28日

在 GitHub 查看
 (8 留言) (3 反應) (0 負責人)C++ (16,128 fork)batch import
help wantedphp

倉庫指標

Star
 (71,223 star)
PR 合併指標
 (平均合併 2天 11小時) (30 天內合併 185 個 PR)

描述

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)
}

貢獻者指南