haberman / protobuf

Protocol Buffers - Google's data interchange format

Home Page:https://developers.google.com/protocol-buffers/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

serializeToJsonString uses " ," for separator instead of "," for array values

PierrickVoulet opened this issue · comments

What version of protobuf and what language are you using?
Version: php-upb-msg (protobuf2)
Language: PHP

What operating system (Linux, Windows, ...) and version?
Linux 5.2.17-1rodete3-amd64 x86_64

What runtime / compiler are you using (e.g., python version or gcc version)
PHP Extension (C implementation)

What did you do?
Run the following script (some proto messages are defined here):

<?php
$array = new \Google\Ads\GoogleAds\V3\Services\SearchGoogleAdsResponse([
    'results' => [
        new \Google\Ads\GoogleAds\V3\Services\GoogleAdsRow([
            'campaign' => new \Google\Ads\GoogleAds\V3\Resources\Campaign([
                'id' => new \Google\Protobuf\Int64Value(['value' => 1])
            ])
        ]),
        new \Google\Ads\GoogleAds\V3\Services\GoogleAdsRow([
            'campaign' => new \Google\Ads\GoogleAds\V3\Resources\Campaign([
                'id' => new \Google\Protobuf\Int64Value(['value' => 1])
            ])
        ])
    ]
]);
print $array->serializeToJsonString();

What did you expect to see
{"results":[{"campaign":{"id":"1"}},{"campaign":{"id":"1"}}]}

What did you see instead?
{"results":[{"campaign":{"id":"1"}}, {"campaign":{"id":"1"}}]}

Anything else we should know about your project / environment
Removing the extra space on this line fixed the issue on my side.

This should be fixed in 5031469. Please re-open if you run into it again.

Verified