Changeset View
Changeset View
Standalone View
Standalone View
src/parser/xhpast/api/XHPASTNode.php
Context not available. | |||||
return phutil_string_cast($this->getStringLiteralValue()); | return phutil_string_cast($this->getStringLiteralValue()); | ||||
case 'n_NUMERIC_SCALAR': | case 'n_NUMERIC_SCALAR': | ||||
$value = $this->getSemanticString(); | $value = $this->getSemanticString(); | ||||
if (preg_match('/^0x/i', $value)) { | if (@preg_match('/^0x/i', $value)) { | ||||
// Hex | // Hex | ||||
$value = base_convert(substr($value, 2), 16, 10); | $value = base_convert(@substr($value, 2), 16, 10); | ||||
} else if (preg_match('/^0\d+$/i', $value)) { | } else if (@preg_match('/^0\d+$/i', $value)) { | ||||
// Octal | // Octal | ||||
$value = base_convert(substr($value, 1), 8, 10); | $value = base_convert(@substr($value, 1), 8, 10); | ||||
} | } | ||||
return +$value; | return +$value; | ||||
case 'n_SYMBOL_NAME': | case 'n_SYMBOL_NAME': | ||||
Context not available. | |||||
if ($value == 'INF') { | if ($value == 'INF') { | ||||
return INF; | return INF; | ||||
} | } | ||||
switch (strtolower($value)) { | switch (@strtolower($value)) { | ||||
case 'true': | case 'true': | ||||
return true; | return true; | ||||
case 'false': | case 'false': | ||||
Context not available. | |||||
switch ($this->getTypeName()) { | switch ($this->getTypeName()) { | ||||
case 'n_HEREDOC': | case 'n_HEREDOC': | ||||
if (preg_match("/^<<<\s*'/", $value)) { // Nowdoc: <<<'EOT' | if (@preg_match("/^<<<\s*'/", $value)) { // Nowdoc: <<<'EOT' | ||||
return array(); | return array(); | ||||
} | } | ||||
break; | break; | ||||
Context not available. | |||||
// literally "\q" and "\'". stripcslashes() is too aggressive, so find | // literally "\q" and "\'". stripcslashes() is too aggressive, so find | ||||
// all these under-escaped backslashes and escape them. | // all these under-escaped backslashes and escape them. | ||||
$len = strlen($value); | $len = @strlen($value); | ||||
$esc = false; | $esc = false; | ||||
$out = ''; | $out = ''; | ||||
Context not available. | |||||
switch ($c) { | switch ($c) { | ||||
case 'x': | case 'x': | ||||
$u = isset($value[$ii + 1]) ? $value[$ii + 1] : null; | $u = isset($value[$ii + 1]) ? $value[$ii + 1] : null; | ||||
if (!preg_match('/^[a-f0-9]/i', $u)) { | if (!@preg_match('/^[a-f0-9]/i', $u)) { | ||||
// PHP treats \x followed by anything which is not a hex digit | // PHP treats \x followed by anything which is not a hex digit | ||||
// as a literal \x. | // as a literal \x. | ||||
$out .= '\\\\'.$c; | $out .= '\\\\'.$c; | ||||
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