mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/10020] Fix 32-bit php braindamage around INT_MIN.
On 32-bit php, -2147483648, despite fitting in the int type, is for some reason made into a floating-point value. Use an explicit cast to make it an integer. PHPBB3-10020
This commit is contained in:
parent
15992ceff9
commit
d13efa41c5
1 changed files with 5 additions and 2 deletions
|
@ -573,8 +573,11 @@ function validate_range($value_ary, &$error)
|
||||||
'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1),
|
'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1),
|
||||||
'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535),
|
'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535),
|
||||||
'UINT' => array('php_type' => 'int', 'min' => 0, 'max' => (int) 0x7fffffff),
|
'UINT' => array('php_type' => 'int', 'min' => 0, 'max' => (int) 0x7fffffff),
|
||||||
// Do not use (int) 0x80000000 - it evaluates to different values on 32-bit and 64-bit systems.
|
// Do not use (int) 0x80000000 - it evaluates to different
|
||||||
'INT' => array('php_type' => 'int', 'min' => -2147483648, 'max' => (int) 0x7fffffff),
|
// values on 32-bit and 64-bit systems.
|
||||||
|
// Apparently -2147483648 is a float on 32-bit systems,
|
||||||
|
// despite fitting in an int, thus explicit cast is needed.
|
||||||
|
'INT' => array('php_type' => 'int', 'min' => (int) -2147483648, 'max' => (int) 0x7fffffff),
|
||||||
'TINT' => array('php_type' => 'int', 'min' => -128, 'max' => 127),
|
'TINT' => array('php_type' => 'int', 'min' => -128, 'max' => 127),
|
||||||
|
|
||||||
'VCHAR' => array('php_type' => 'string', 'min' => 0, 'max' => 255),
|
'VCHAR' => array('php_type' => 'string', 'min' => 0, 'max' => 255),
|
||||||
|
|
Loading…
Add table
Reference in a new issue