mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-25 22:36:02 +03:00
Fixed failed integer test (only fails on some OSs and PHP versions)
This commit is contained in:
parent
c97438cd7d
commit
2023b427ae
@ -74,7 +74,10 @@ values. Int can represent values between -(2^31) and 2^31 - 1. ';
|
|||||||
*/
|
*/
|
||||||
public function parseValue($value)
|
public function parseValue($value)
|
||||||
{
|
{
|
||||||
return (is_int($value) && $value <= self::MAX_INT && $value >= self::MIN_INT) ? $value : null;
|
// Below is a fix against PHP bug where (in some combinations of OSs and versions)
|
||||||
|
// boundary values are treated as "double" vs "integer" and failing is_int() check
|
||||||
|
$isInt = is_int($value) || $value === self::MIN_INT || $value === self::MAX_INT;
|
||||||
|
return $isInt && $value <= self::MAX_INT && $value >= self::MIN_INT ? $value : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user