[codefilter_code]There were 2 failures:

1) Drupal\Tests\Component\Utility\JsonTest::testReversibility
Encoding a string to JSON and decoding back results in the original string.
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@

#10 json-wtf-2068593-10.patch1.13 KBBerdir
PASSED: [[SimpleTest]]: [MySQL] 58,783 pass(es).
[ View ]
#7 json-wtf-2068593-7.patch574 bytesBerdir
FAILED: [[SimpleTest]]: [MySQL] 59,054 pass(es), 1 fail(s), and 0 exception(s).
[ View ]
#1 failure.txt1.81 KBParisLiakos


new1.81 KB

seems, it wont show correctly, so attaching the failure as txt

maybe it is because of #1210798: In PHP 5.4, html_entity_decode() doesn't decode invalid numeric entities
we had similar problems with the XssTest

Seems to be only chr(0) that's causing problems. populating with 1-128 instead of 0-128 fixes the tests. We can probably ignore testings encoding NULL characters.

Trying to run this on http://3v4l.org/pCtWM but it seems to work fine in 5.3.0 - 5.5.4? Something wrong with my test script?

your script returns bool(false) in my 5.5.4 enviroment

it gives me bool(true) if i modify the for to start from 1 and not 0


I looked into it a bit more, its treating the NUL as a string terminator. If you move the NUL to the end of the string the decoded value still doesn't match but its 127 characters long instead of 0.

I'd like more buy in but I'm not sure we need to test the NUL character. We're not testing PHP here but that things behave sanely. 1-128 still seems a valid testing string.

As far as the observations, I'm wondering if JSON library versions are behaving different. That would mean its not actually the PHP version so much as the JSON library its linked against which makes more sense and matches Berdir's observation.

Here's some information about my setup:

PHP version string: PHP 5.5.4-1+debphp.org~raring+1 (cli) (built: Sep 27 2013 12:47:39)
This ppa: http://ppa.launchpad.net/ondrej/php5/ubuntu
JSON section from my phpinfo:

json support enabled
json version 1.3.2-dev
JSON-C headers version 0.11.99
JSON-C library version 0.11.99

And what I could get from 34vl for their version of 5.4 (surprisingly phpinfo wasn't blocked and didn't blow up).
json json support => enabled
json version => 1.2.1

I notice they have 1.2.1 and I've got 1.3.2-dev(which comes from the ppa).

Status:Active» Needs review
new574 bytes
FAILED: [[SimpleTest]]: [MySQL] 59,054 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

Yes, I thought it could be a library. Which is crazy.

Anyway, I'm fine with starting with 1. We should probably open an upstream bug report about it, though?

the json project debian builds its php5-json package:
where there is a relevant issue https://github.com/remicollet/pecl-json-c/issues/7 ..and i think a commit happened which might have fixed that..i will try to test it

Status:Needs review» Needs work

The last submitted patch, json-wtf-2068593-7.patch, failed testing.

Status:Needs work» Needs review
Issue tags:+PHP 5.5
new1.13 KB
PASSED: [[SimpleTest]]: [MySQL] 58,783 pass(es).
[ View ]

There's really no excuse for not executing a unit test before uploading a patch :)

I think even (or actually, especially!) when we can prove that this test fail is related to the issue linked in #8 and hopefully fixed by it, we still need to do this, we can't change which version debian/ubuntu ships soon enough I assume.

Status:Needs review» Reviewed & tested by the community
Issue tags:-PHP 5.5

Passes for me. Assuming core isn't broken this'll come back green so...

Issue tags:+PHP 5.5


Title:JsonTest fails on PHP 5.5JsonTest fails with pecl-json

fixing for commits.

Status:Reviewed & tested by the community» Fixed

I've no issue with committing this, but this is by far the most bizarre bug I've ever seen. $i = 0 is not exactly crazy edge case material. Well done tracking this down!

Committed and pushed to 8.x. Thanks!

@webchick: It's not $i = 0 that's special, it's chr($i) when $i = 0.

just FYI: the issue in #8 fixes that upstream..it is now in fedora and debian

Automatically closed -- issue fixed for 2 weeks with no activity.