From f845217e07fdab2138587b01745b4067b7062ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=B7=E7=9B=9BDiscuz!?= Date: Tue, 20 Dec 2016 23:04:05 -0500 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20dintval=E5=9C=A8PHP?= =?UTF-8?q?=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- upload/install/include/install_function.php | 21 +++++++++++++++++++-- upload/source/function/function_core.php | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/upload/install/include/install_function.php b/upload/install/include/install_function.php index 6c4ff33..e2b7300 100644 --- a/upload/install/include/install_function.php +++ b/upload/install/include/install_function.php @@ -170,6 +170,23 @@ function function_check(&$func_items) { } } +function dintval($int, $allowarray = false) { + $ret = floatval($int); + if($int == $ret || !$allowarray && is_array($int)) return $ret; + if($allowarray && is_array($int)) { + foreach($int as &$v) { + $v = dintval($v, true); + } + return $int; + } elseif($int <= 0xffffffff) { + $l = strlen($int); + $m = substr($int, 0, 1) == '-' ? 1 : 0; + if(($l - $m) === strspn($int,'0987654321', $m)) { + return $int; + } + } + return $ret; +} function show_env_result(&$env_items, &$dirfile_items, &$func_items, &$filesock_items) { $env_str = $file_str = $dir_str = $func_str = ''; @@ -181,8 +198,8 @@ function show_env_result(&$env_items, &$dirfile_items, &$func_items, &$filesock_ } $status = 1; if($item['r'] != 'notset') { - if(intval($item['current']) && intval($item['r'])) { - if(intval($item['current']) < intval($item['r'])) { + if(dintval($item['current']) && dintval($item['r'])) { + if(dintval($item['current']) < dintval($item['r'])) { $status = 0; $error_code = ENV_CHECK_ERROR; } diff --git a/upload/source/function/function_core.php b/upload/source/function/function_core.php index c94f92a..81bdbe0 100644 --- a/upload/source/function/function_core.php +++ b/upload/source/function/function_core.php @@ -1993,7 +1993,7 @@ function userappprompt() { } function dintval($int, $allowarray = false) { - $ret = intval($int); + $ret = floatval($int); if($int == $ret || !$allowarray && is_array($int)) return $ret; if($allowarray && is_array($int)) { foreach($int as &$v) {