diff options
author | Igor Wiedler <igor@wiedler.ch> | 2010-06-25 19:09:17 +0200 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2010-12-28 22:37:33 +0100 |
commit | 6b4d0a254218e8d40151ca1bdff8c439f89502e9 (patch) | |
tree | 18a2fdf9db565110c73f796e030b1fbed2393472 /phpBB/includes/functions.php | |
parent | eda9fbbb6363cad0f2035b7a1f9fafe27f23832b (diff) | |
download | forums-6b4d0a254218e8d40151ca1bdff8c439f89502e9.tar forums-6b4d0a254218e8d40151ca1bdff8c439f89502e9.tar.gz forums-6b4d0a254218e8d40151ca1bdff8c439f89502e9.tar.bz2 forums-6b4d0a254218e8d40151ca1bdff8c439f89502e9.tar.xz forums-6b4d0a254218e8d40151ca1bdff8c439f89502e9.zip |
[ticket/9574] Add pcre_utf8_support() function
Refactor the check for PCRE UTF-8 support into a new pcre_utf8_support()
function.
PHPBB3-9574
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 48a9661347..285c3938c1 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4507,3 +4507,19 @@ function phpbb_user_session_handler() return; } + +/** +* Check if PCRE has UTF-8 support +* PHP may not be linked with the bundled PCRE lib and instead with an older version +* +* @return bool Returns true if PCRE (the regular expressions library) supports UTF-8 encoding +*/ +function pcre_utf8_support() +{ + static $utf8_pcre_properties = null; + if (is_null($utf8_pcre_properties)) + { + $utf8_pcre_properties = (@preg_match('/\p{L}/u', 'a') !== false); + } + return $utf8_pcre_properties; +} |