From 3a7731a6f0314927c2db305415a1f38f7d227fbc Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Sun, 17 Apr 2011 10:48:17 +0000 Subject: [PATCH] Fix broken check for bad JSON encoders, had been broken since inception and caused the native JSON encoder to always be bypassed in favor of Services_JSON. --- includes/json/FormatJson.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/json/FormatJson.php b/includes/json/FormatJson.php index f9667f54ba..339bdd3630 100644 --- a/includes/json/FormatJson.php +++ b/includes/json/FormatJson.php @@ -30,7 +30,11 @@ class FormatJson { // Some versions of PHP have a broken json_encode, see PHP bug // 46944. Test encoding an affected character (U+20000) to // avoid this. - if ( !function_exists( 'json_encode' ) || $isHtml || strtolower( json_encode( "\xf0\xa0\x80\x80" ) ) != '\ud840\udc00' ) { + if ( !function_exists( 'json_encode' ) || $isHtml || strtolower( json_encode( "\xf0\xa0\x80\x80" ) ) != '"\ud840\udc00"' ) { + var_dump(function_exists('json_encode')); + var_dump($isHtml); + var_dump(strtolower(json_encode("\xf0\xa0\x80\x80"))); + var_dump('\ud840\udc00'); $json = new Services_JSON(); return $json->encode( $value, $isHtml ); } else { -- 2.20.1