https://bugs.php.net/bug.php?id=46944
Fixed for 5.3.0, and as we require >= 5.3.2, workaround is redundant
http://php.net/ChangeLog-5.php
Change-Id: I567466c0c747dba2f903e9258d0f06f725cefb8f
* @return string
*/
public static function encode( $value, $isHtml = false ) {
- // 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 ) {
$json = new Services_JSON();
return $json->encode( $value, $isHtml );
} else {