mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
Fix bug #16555 - Word censoring doesn't support unicode strings
Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9624 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -84,7 +84,15 @@ class cache extends acm
|
||||
$censors = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$censors['match'][] = '#(?<!\w)(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')(?!\w)#i';
|
||||
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)
|
||||
{
|
||||
$censors['match'][] = '#(?<!\p{L})(' . str_replace('\*', '\p{L}*?', preg_quote($row['word'], '#')) . ')(?!\p{L})#u';
|
||||
}
|
||||
else
|
||||
{
|
||||
$censors['match'][] = '#(?<!\S)(' . str_replace('\*', '\S*?', preg_quote($row['word'], '#')) . ')(?!\S)#iu';
|
||||
}
|
||||
|
||||
$censors['replace'][] = $row['replacement'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
Reference in New Issue
Block a user