From 6b4d0a254218e8d40151ca1bdff8c439f89502e9 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Fri, 25 Jun 2010 19:09:17 +0200 Subject: [ticket/9574] Add pcre_utf8_support() function Refactor the check for PCRE UTF-8 support into a new pcre_utf8_support() function. PHPBB3-9574 --- phpBB/includes/functions.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'phpBB/includes/functions.php') 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; +} -- cgit v1.2.1