When using the json_name option to control the name of serialized attributes, the pure-PHP implementation of protobuf works as expected. However the C extension ignores the option completely.
// test.prot
syntax="proto3";
message Foo {
int32 foo = 1 [json_name="bar"];
}
<?php
// test.php
require "vendor/autoload.php";
$foo = new Foo();
$foo->setFoo(42);
echo $foo->serializeToJsonString(), "\n";
$ protoc --php_out=. test.proto
$ php test.php
{"bar":42} # ok
$ php -dextension=protobuf.so test.php
{"foo":42} # not ok with extension
This is a known issue in c extension. Currently, we haven't fixed all conformance test for c extension. Will do it gradually.
whitch version will support?