From 8b0e11a4c90e63de733d4043b573e846af9c787e Mon Sep 17 00:00:00 2001 From: David M Date: Thu, 16 Nov 2006 20:16:36 +0000 Subject: #5362 - small opti/bugfix in normalizer git-svn-id: file:///svn/phpbb/trunk@6593 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/utf/utf_tools.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/utf/utf_tools.php') diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index b181023f57..0a4763b080 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -126,7 +126,14 @@ if (extension_loaded('mbstring')) return false; } - return mb_strrpos($str, $search); + if (is_null($offset)) + { + return mb_strrpos($str, $search); + } + else + { + return mb_strrpos($str, $search, $offset); + } } } else @@ -138,7 +145,7 @@ if (extension_loaded('mbstring')) function utf8_strrpos($str, $needle, $offset = null) { // offset for mb_strrpos was added in 5.2.0 - if ($offset === false) + if (is_null($offset)) { // Emulate behaviour of strrpos rather than raising warning if (empty($str)) @@ -174,7 +181,7 @@ if (extension_loaded('mbstring')) */ function utf8_strpos($str, $needle, $offset = null) { - if ($offset === false) + if (is_null($offset)) { return mb_strpos($str, $needle); } @@ -208,7 +215,7 @@ if (extension_loaded('mbstring')) */ function utf8_substr($str, $offset, $length = null) { - if ($length === false) + if (is_null($length)) { return mb_substr($str, $offset); } -- cgit v1.2.1