Skip to content

Commit 2023b42

Browse files
committed
Fixed failed integer test (only fails on some OSs and PHP versions)
1 parent c97438c commit 2023b42

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Type/Definition/IntType.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ public function serialize($value)
7474
*/
7575
public function parseValue($value)
7676
{
77-
return (is_int($value) && $value <= self::MAX_INT && $value >= self::MIN_INT) ? $value : null;
77+
// Below is a fix against PHP bug where (in some combinations of OSs and versions)
78+
// boundary values are treated as "double" vs "integer" and failing is_int() check
79+
$isInt = is_int($value) || $value === self::MIN_INT || $value === self::MAX_INT;
80+
return $isInt && $value <= self::MAX_INT && $value >= self::MIN_INT ? $value : null;
7881
}
7982

8083
/**

0 commit comments

Comments
 (0)