Fix broken check for bad JSON encoders, had been broken since inception and caused...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sun, 17 Apr 2011 10:48:17 +0000 (10:48 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sun, 17 Apr 2011 10:48:17 +0000 (10:48 +0000)
includes/json/FormatJson.php

index f9667f5..339bdd3 100644 (file)
@@ -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 {