Skip to content

Commit e341c2d

Browse files
Fixed validation of numeric strings. These will and must be strictly handled as strings to support a numeric string _key.
1 parent 9fd59ea commit e341c2d

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Setup PHP
1414
uses: shivammathur/setup-php@v2
1515
with:
16-
php-version: '7.2'
16+
php-version: '7.4'
1717
extensions: mbstring, intl
1818
ini-values: post_max_size=256M, short_open_tag=On
1919
coverage: xdebug

src/Traits/ValidatesExpressions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function isNull($value): bool
7979
*/
8080
public function isNumber($value): bool
8181
{
82-
return is_numeric($value);
82+
return is_numeric($value) && !is_string($value);
8383
}
8484

8585
/**

tests/Unit/AQL/OperatorExpressionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class OperatorExpressionsTest extends TestCase
1414
public function testIf()
1515
{
1616
$qb = new QueryBuilder();
17-
$qb->let('x', 5)->return($qb->if(['x', '==', '5'], true, false));
17+
$qb->let('x', 5)->return($qb->if(['x', '==', 5], true, false));
1818
self::assertEquals("LET x = 5 RETURN (x == 5) ? true : false", $qb->get()->query);
1919
}
2020

tests/Unit/GrammarTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ public function testIsNumeric()
293293

294294
$result = $this->grammar->isNumber('string');
295295
self::assertFalse($result);
296+
297+
$result = $this->grammar->isNumber('1');
298+
self::assertFalse($result);
296299
}
297300

298301
public function testFormatBind()

0 commit comments

Comments
 (0)