aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2012-06-11 15:22:55 +0200
committerAndreas Fischer <bantu@phpbb.com>2012-06-11 15:46:03 +0200
commitcbff02db4f84c83c62bdd1f7450b8afbf39a5270 (patch)
tree14faafb86df15b64c767da6458cea05e1a53b52a /phpBB
parent09fb9a9efe048cef102471d1ce79cdeff932776a (diff)
downloadforums-cbff02db4f84c83c62bdd1f7450b8afbf39a5270.tar
forums-cbff02db4f84c83c62bdd1f7450b8afbf39a5270.tar.gz
forums-cbff02db4f84c83c62bdd1f7450b8afbf39a5270.tar.bz2
forums-cbff02db4f84c83c62bdd1f7450b8afbf39a5270.tar.xz
forums-cbff02db4f84c83c62bdd1f7450b8afbf39a5270.zip
[ticket/10931] Make to_numeric function globally available.
PHPBB3-10931
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/functions.php13
-rw-r--r--phpBB/includes/php/ini.php17
2 files changed, 15 insertions, 15 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 95f2cf8d26..ad64471388 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -4987,3 +4987,16 @@ function phpbb_pcre_utf8_support()
}
return $utf8_pcre_properties;
}
+
+/**
+* Casts a numeric string $input to an appropriate numeric type (i.e. integer or float)
+*
+* @param string $input A numeric string.
+*
+* @return int|float Integer $input if $input fits integer,
+* float $input otherwise.
+*/
+function phpbb_to_numeric($input)
+{
+ return ($input > PHP_INT_MAX) ? (float) $input : (int) $input;
+}
diff --git a/phpBB/includes/php/ini.php b/phpBB/includes/php/ini.php
index bbe592a7df..02c2b7ccc6 100644
--- a/phpBB/includes/php/ini.php
+++ b/phpBB/includes/php/ini.php
@@ -138,7 +138,7 @@ class phpbb_php_ini
if (is_numeric($value))
{
// Already in bytes.
- return $this->to_numeric($value);
+ return phpbb_to_numeric($value);
}
else if (strlen($value) < 2)
{
@@ -151,7 +151,7 @@ class phpbb_php_ini
return false;
}
- $value_numeric = $this->to_numeric($value);
+ $value_numeric = phpbb_to_numeric($value);
switch ($value[strlen($value) - 1])
{
@@ -171,17 +171,4 @@ class phpbb_php_ini
return $value_numeric;
}
-
- /**
- * Casts a numeric string $input to an appropriate numeric type (i.e. integer or float)
- *
- * @param string $input A numeric string.
- *
- * @return int|float Integer $input if $input fits integer,
- * float $input otherwise.
- */
- protected function to_numeric($input)
- {
- return ($input > PHP_INT_MAX) ? (float) $input : (int) $input;
- }
}