From: Roan Kattouw Date: Sun, 17 Apr 2011 10:48:17 +0000 (+0000) Subject: Fix broken check for bad JSON encoders, had been broken since inception and caused... X-Git-Tag: 1.31.0-rc.0~30758 X-Git-Url: http://git.cyclocoop.org//%22javascript:ModifierStyle%28%27%22.%24id.%22%27%29/%22?a=commitdiff_plain;h=3a7731a6f0314927c2db305415a1f38f7d227fbc;p=lhc%2Fweb%2Fwiklou.git 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. --- 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 {