[ExpressionLanguage] Avoid dependency on ctype
This avoids ExpressionLanguage library dependency on ctype.
This commit is contained in:
parent
d48fae7f8c
commit
81de5fef4b
@ -45,7 +45,7 @@ class Lexer
|
|||||||
if (preg_match('/[0-9]+(?:\.[0-9]+)?/A', $expression, $match, null, $cursor)) {
|
if (preg_match('/[0-9]+(?:\.[0-9]+)?/A', $expression, $match, null, $cursor)) {
|
||||||
// numbers
|
// numbers
|
||||||
$number = (float) $match[0]; // floats
|
$number = (float) $match[0]; // floats
|
||||||
if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) {
|
if (preg_match('/^[0-9]+$/', $match[0]) && $number <= PHP_INT_MAX) {
|
||||||
$number = (int) $match[0]; // integers lower than the maximum
|
$number = (int) $match[0]; // integers lower than the maximum
|
||||||
}
|
}
|
||||||
$tokens[] = new Token(Token::NUMBER_TYPE, $number, $cursor + 1);
|
$tokens[] = new Token(Token::NUMBER_TYPE, $number, $cursor + 1);
|
||||||
|
Reference in New Issue
Block a user