* @note These are listed in ECMA-262 (5.1 Ed.), ยง7.3 Line Terminators along with U+000A (LF)
* and U+000D (CR). However, PHP already escapes LF and CR according to RFC 4627.
*/
- private static $badChars = array(
+ private static $badChars = [
"\xe2\x80\xa8", // U+2028 LINE SEPARATOR
"\xe2\x80\xa9", // U+2029 PARAGRAPH SEPARATOR
- );
+ ];
/**
* Escape sequences for characters listed in FormatJson::$badChars.
*/
- private static $badCharsEscaped = array(
+ private static $badCharsEscaped = [
'\u2028', // U+2028 LINE SEPARATOR
'\u2029', // U+2029 PARAGRAPH SEPARATOR
- );
+ ];
/**
* Returns the JSON representation of a value.
static $bug66021;
if ( $pretty !== false && $bug66021 === null ) {
- $bug66021 = json_encode( array(), JSON_PRETTY_PRINT ) !== '[]';
+ $bug66021 = json_encode( [], JSON_PRETTY_PRINT ) !== '[]';
}
// PHP escapes '/' to prevent breaking out of inline script blocks using '</script>',
$count = 0;
$value =
preg_replace( '/,([ \t]*[}\]][^"\r\n]*([\r\n]|$)|[ \t]*[\r\n][ \t\r\n]*[}\]])/', '$1',
- $value, - 1, $count );
+ $value, -1, $count );
if ( $count > 0 ) {
$result = json_decode( $value, $assoc );
if ( JSON_ERROR_NONE === json_last_error() ) {
*/
public static function stripComments( $json ) {
// Ensure we have a string
- $str = (string) $json;
+ $str = (string)$json;
$buffer = '';
$maxLen = strlen( $str );
$mark = 0;