diff options
author | David M <davidmj@users.sourceforge.net> | 2007-07-23 04:14:49 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2007-07-23 04:14:49 +0000 |
commit | e61e01a3b93a57139efc433d892e10dd66a32b71 (patch) | |
tree | 70328a6b9274e2a598a1239e7606f74cd079348a /phpBB/includes | |
parent | 092fb766419d72a61032a06ce7359ccfe5af29d1 (diff) | |
download | forums-e61e01a3b93a57139efc433d892e10dd66a32b71.tar forums-e61e01a3b93a57139efc433d892e10dd66a32b71.tar.gz forums-e61e01a3b93a57139efc433d892e10dd66a32b71.tar.bz2 forums-e61e01a3b93a57139efc433d892e10dd66a32b71.tar.xz forums-e61e01a3b93a57139efc433d892e10dd66a32b71.zip |
- a better way of checking PCRE property support
- fixed the naming of a variable or two
git-svn-id: file:///svn/phpbb/trunk@7925 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions_user.php | 4 | ||||
-rw-r--r-- | phpBB/includes/search/fulltext_mysql.php | 6 | ||||
-rw-r--r-- | phpBB/includes/utf/utf_tools.php | 8 |
3 files changed, 11 insertions, 7 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 96f9b75964..4de247d33c 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1284,7 +1284,7 @@ function validate_username($username, $allowed_username = false) $mbstring = $pcre = false; // generic UTF-8 character types supported? - if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) + if ((version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) && @preg_match('/\p{L}/u', 'a') !== false) { $pcre = true; } @@ -1435,7 +1435,7 @@ function validate_password($password) $pcre = $mbstring = false; // generic UTF-8 character types supported? - if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) + if ((version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) && @preg_match('/\p{L}/u', 'a') !== false) { $upp = '\p{Lu}'; $low = '\p{Ll}'; diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 760b0753f2..951ef5b69f 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -43,7 +43,11 @@ class fulltext_mysql extends search_backend if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) { - $this->pcre_properties = true; + // While this is the proper range of PHP versions, PHP may not be linked with the bundled PCRE lib and instead with an older version + if (@preg_match('/\p{L}/u', 'a') !== false) + { + $this->pcre_properties = true; + } } if (function_exists('mb_ereg')) diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index b4ad6a7af9..0c855be7c3 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -338,7 +338,7 @@ else */ function utf8_strtolower($string) { - static $UTF8_UPPER_TO_LOWER = array( + static $utf8_upper_to_lower = array( "\xC3\x80" => "\xC3\xA0", "\xC3\x81" => "\xC3\xA1", "\xC3\x82" => "\xC3\xA2", "\xC3\x83" => "\xC3\xA3", "\xC3\x84" => "\xC3\xA4", "\xC3\x85" => "\xC3\xA5", "\xC3\x86" => "\xC3\xA6", "\xC3\x87" => "\xC3\xA7", "\xC3\x88" => "\xC3\xA8", "\xC3\x89" => "\xC3\xA9", @@ -387,7 +387,7 @@ else "\xE1\xBA\x82" => "\xE1\xBA\x83", "\xE1\xBA\x84" => "\xE1\xBA\x85", "\xE1\xBB\xB2" => "\xE1\xBB\xB3" ); - return strtr(strtolower($string), $UTF8_UPPER_TO_LOWER); + return strtr(strtolower($string), $utf8_upper_to_lower); } /** @@ -403,7 +403,7 @@ else */ function utf8_strtoupper($string) { - static $UTF8_LOWER_TO_UPPER = array( + static $utf8_lower_to_upper = array( "\xC3\xA0" => "\xC3\x80", "\xC3\xA1" => "\xC3\x81", "\xC3\xA2" => "\xC3\x82", "\xC3\xA3" => "\xC3\x83", "\xC3\xA4" => "\xC3\x84", "\xC3\xA5" => "\xC3\x85", "\xC3\xA6" => "\xC3\x86", "\xC3\xA7" => "\xC3\x87", "\xC3\xA8" => "\xC3\x88", "\xC3\xA9" => "\xC3\x89", @@ -452,7 +452,7 @@ else "\xE1\xBA\x83" => "\xE1\xBA\x82", "\xE1\xBA\x85" => "\xE1\xBA\x84", "\xE1\xBB\xB3" => "\xE1\xBB\xB2" ); - return strtr(strtoupper($string), $UTF8_LOWER_TO_UPPER); + return strtr(strtoupper($string), $utf8_lower_to_upper); } /** |