Changeset View
Changeset View
Standalone View
Standalone View
externals/jsonlint/src/Seld/JsonLint/JsonParser.php
Context not available. | |||||
} | } | ||||
$message = null; | $message = null; | ||||
if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) { | if (in_array("'STRING'", $expected) && in_array(@substr($this->lexer->match, 0, 1), array('"', "'"))) { | ||||
$message = "Invalid string"; | $message = "Invalid string"; | ||||
if ("'" === substr($this->lexer->match, 0, 1)) { | if ("'" === @substr($this->lexer->match, 0, 1)) { | ||||
$message .= ", it appears you used single quotes instead of double quotes"; | $message .= ", it appears you used single quotes instead of double quotes"; | ||||
} elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) { | } elseif (@preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) { | ||||
$message .= ", it appears you have an unescaped backslash at: ".$match[1]; | $message .= ", it appears you have an unescaped backslash at: ".$match[1]; | ||||
} elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) { | } elseif (@preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) { | ||||
$message .= ", it appears you forgot to terminate the string, or attempted to write a multiline string which is invalid"; | $message .= ", it appears you forgot to terminate the string, or attempted to write a multiline string which is invalid"; | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
$errStr .= implode(', ', $expected); | $errStr .= implode(', ', $expected); | ||||
} | } | ||||
if (',' === substr(trim($this->lexer->getPastInput()), -1)) { | if (',' === @substr(trim($this->lexer->getPastInput()), -1)) { | ||||
$errStr .= " - It appears you have an extra trailing comma"; | $errStr .= " - It appears you have an extra trailing comma"; | ||||
} | } | ||||
Context not available. | |||||
$yyval->token = $yytext; | $yyval->token = $yytext; | ||||
break; | break; | ||||
case 2: | case 2: | ||||
if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) { | if (@strpos($yytext, 'e') !== false || @strpos($yytext, 'E') !== false) { | ||||
$yyval->token = floatval($yytext); | $yyval->token = floatval($yytext); | ||||
} else { | } else { | ||||
$yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext); | $yyval->token = @strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext); | ||||
} | } | ||||
break; | break; | ||||
case 3: | case 3: | ||||
Context not available. | |||||
case '\/': | case '\/': | ||||
return "/"; | return "/"; | ||||
default: | default: | ||||
return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8'); | return html_entity_decode('&#x'.ltrim(@substr($match[0], 2), '0').';', 0, 'UTF-8'); | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
// UTF-8 ByteOrderMark sequence | // UTF-8 ByteOrderMark sequence | ||||
$bom = "\xEF\xBB\xBF"; | $bom = "\xEF\xBB\xBF"; | ||||
if (substr($input, 0, 3) === $bom) { | if (@substr($input, 0, 3) === $bom) { | ||||
$this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array()); | $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array()); | ||||
} | } | ||||
} | } | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0