File tree Expand file tree Collapse file tree 4 files changed +16
-1
lines changed
src/Google/Protobuf/Internal Expand file tree Collapse file tree 4 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ Required.Proto3.JsonInput.FloatFieldTooSmall
1313Required.Proto3.JsonInput.DoubleFieldTooSmall
1414Required.Proto3.JsonInput.Int32FieldNotInteger
1515Required.Proto3.JsonInput.Int64FieldNotInteger
16+ Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
17+ Required.Proto3.JsonInput.StringFieldNotAString
1618Required.Proto3.JsonInput.Uint32FieldNotInteger
1719Required.Proto3.JsonInput.Uint64FieldNotInteger
1820Required.Proto3.JsonInput.Int32FieldLeadingSpace
Original file line number Diff line number Diff line change @@ -832,6 +832,9 @@ private function convertJsonValueToProtoValue(
832832 if (is_null ($ value )) {
833833 return $ this ->defaultValue ($ field );
834834 }
835+ if (is_numeric ($ value )) {
836+ return strval ($ value );
837+ }
835838 if (!is_string ($ value )) {
836839 throw new GPBDecodeException (
837840 "String field only accepts string value " );
Original file line number Diff line number Diff line change @@ -1148,4 +1148,14 @@ public function testJsonDecodeMapWithDefaultValueKey()
11481148 $ m ->serializeToJsonString ());
11491149 }
11501150
1151+ public function testJsonDecodeNumericStringMapKey ()
1152+ {
1153+ $ m = new TestMessage ();
1154+ $ m ->getMapStringString ()["1 " ] = "1 " ;
1155+ $ data = $ m ->serializeToJsonString ();
1156+ $ this ->assertSame ("{ \"mapStringString \":{ \"1 \": \"1 \"}} " , $ data );
1157+ $ n = new TestMessage ();
1158+ $ n ->mergeFromJsonString ($ data );
1159+ }
1160+
11511161}
Original file line number Diff line number Diff line change @@ -482,7 +482,7 @@ build_php5.6_mac() {
482482 export PATH=" $PHP_FOLDER /bin:$PATH "
483483
484484 # Install phpunit
485- curl https://phar.phpunit.de/phpunit-5.6.10 .phar -L -o phpunit.phar
485+ curl https://phar.phpunit.de/phpunit-5.6.8 .phar -L -o phpunit.phar
486486 chmod +x phpunit.phar
487487 sudo mv phpunit.phar /usr/local/bin/phpunit
488488
You can’t perform that action at this time.
0 commit comments