remicollet/pecl-json-c

json_decode: strings cut off after first null-byte

Briareos opened this issue · 6 comments

In json-c 1.3.2 executing

var_dump(json_decode('{"foo\u0000bar":"bar\u0000baz"}', true));

outputs

array(1) {
  ["foo"] =>
  string(3) "bar"
}

while in json 1.2.1 it outputs

array(1) {
  ["foobar"]=>
  string(7) "barbaz"
}

thus braking stuff mentioned here (among other things).

Previous commit fix the decoding of "value".

For "key", this need some changes in json-c library, see json-c/json-c#108

Hi.
Will this fix https://drupal.org/node/2068593 or they are irrelevant and i should open a new issue for that?

@ParisLiakos I think, but please, try the fix.
(or use Fedora 19 where the patch is already applied)

Yes that fixed it indeed:) I just tried it.
Thanks!

Can anything be done to fix this locally if upstream doesn't respond?

I don't see any simple solution. The library have already lost the data, so I don't see any way to resurrect it.

My plan is to try to merge the json-c into the extension, and thus being able to fix such behavior. Just something I'd like to avoid as musch as possible.