aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/utf
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2010-06-25 13:31:31 +0200
committerIgor Wiedler <igor@wiedler.ch>2010-12-28 22:36:25 +0100
commiteda9fbbb6363cad0f2035b7a1f9fafe27f23832b (patch)
treec023293935fd985b304c7047337fbbf236ea8644 /phpBB/includes/utf
parent1e59666ee32fb00c709644f1f66d3c0b662f32a0 (diff)
downloadforums-eda9fbbb6363cad0f2035b7a1f9fafe27f23832b.tar
forums-eda9fbbb6363cad0f2035b7a1f9fafe27f23832b.tar.gz
forums-eda9fbbb6363cad0f2035b7a1f9fafe27f23832b.tar.bz2
forums-eda9fbbb6363cad0f2035b7a1f9fafe27f23832b.tar.xz
forums-eda9fbbb6363cad0f2035b7a1f9fafe27f23832b.zip
[ticket/9574] Remove conditional PHP<5.2 code
There is a large amount of conditional code for PHP < 5.2 that can be removed with phpBB 3.1. PHPBB3-9574
Diffstat (limited to 'phpBB/includes/utf')
-rw-r--r--phpBB/includes/utf/utf_tools.php72
1 files changed, 14 insertions, 58 deletions
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index 2247315e04..cac5b4e744 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -109,70 +109,26 @@ if (extension_loaded('mbstring'))
/**
* UTF-8 aware alternative to strrpos
* Find position of last occurrence of a char in a string
- *
- * Notes:
- * - offset for mb_strrpos was added in 5.2.0, we emulate if it is lower
*/
- if (version_compare(PHP_VERSION, '5.2.0', '>='))
+ /**
+ * UTF-8 aware alternative to strrpos
+ * @ignore
+ */
+ function utf8_strrpos($str, $needle, $offset = null)
{
- /**
- * UTF-8 aware alternative to strrpos
- * @ignore
- */
- function utf8_strrpos($str, $needle, $offset = null)
+ // Emulate behaviour of strrpos rather than raising warning
+ if (empty($str))
{
- // Emulate behaviour of strrpos rather than raising warning
- if (empty($str))
- {
- return false;
- }
+ return false;
+ }
- if (is_null($offset))
- {
- return mb_strrpos($str, $needle);
- }
- else
- {
- return mb_strrpos($str, $needle, $offset);
- }
+ if (is_null($offset))
+ {
+ return mb_strrpos($str, $needle);
}
- }
- else
- {
- /**
- * UTF-8 aware alternative to strrpos
- * @ignore
- */
- function utf8_strrpos($str, $needle, $offset = null)
+ else
{
- // offset for mb_strrpos was added in 5.2.0
- if (is_null($offset))
- {
- // Emulate behaviour of strrpos rather than raising warning
- if (empty($str))
- {
- return false;
- }
-
- return mb_strrpos($str, $needle);
- }
- else
- {
- if (!is_int($offset))
- {
- trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_ERROR);
- return false;
- }
-
- $str = mb_substr($str, $offset);
-
- if (false !== ($pos = mb_strrpos($str, $needle)))
- {
- return $pos + $offset;
- }
-
- return false;
- }
+ return mb_strrpos($str, $needle, $offset);
}
}