From 15992ceff99cd147d30b81fa237424160779f916 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 1 Feb 2011 21:50:44 -0500 Subject: [ticket/10020] Replaced (int) 0x80000000 with portable equivalent. PHPBB3-10020 --- phpBB/adm/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/adm/index.php') diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 92bcf90039..b6ccb6b241 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -573,7 +573,8 @@ function validate_range($value_ary, &$error) 'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1), 'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535), 'UINT' => array('php_type' => 'int', 'min' => 0, 'max' => (int) 0x7fffffff), - 'INT' => array('php_type' => 'int', 'min' => (int) 0x80000000, 'max' => (int) 0x7fffffff), + // Do not use (int) 0x80000000 - it evaluates to different values on 32-bit and 64-bit systems. + 'INT' => array('php_type' => 'int', 'min' => -2147483648, 'max' => (int) 0x7fffffff), 'TINT' => array('php_type' => 'int', 'min' => -128, 'max' => 127), 'VCHAR' => array('php_type' => 'string', 'min' => 0, 'max' => 255), -- cgit v1.2.1 From d13efa41c5ec0968f9689ac17582106e0673cf8b Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Wed, 2 Feb 2011 09:59:06 -0500 Subject: [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 --- phpBB/adm/index.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'phpBB/adm/index.php') diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index b6ccb6b241..dd8f4c279d 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -573,8 +573,11 @@ function validate_range($value_ary, &$error) 'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1), 'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535), '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. - 'INT' => array('php_type' => 'int', 'min' => -2147483648, 'max' => (int) 0x7fffffff), + // Do not use (int) 0x80000000 - it evaluates to different + // 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), 'VCHAR' => array('php_type' => 'string', 'min' => 0, 'max' => 255), -- cgit v1.2.1