mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Merge branch '3.3.x'
This commit is contained in:
commit
fb37eac0ce
3 changed files with 21 additions and 13 deletions
|
@ -539,7 +539,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||||
{
|
{
|
||||||
if ($row['forum_password_last_post'] === '' && $auth->acl_gets('f_read', 'f_list_topics', $row['forum_id_last_post']))
|
if ($row['forum_password_last_post'] === '' && $auth->acl_gets('f_read', 'f_list_topics', $row['forum_id_last_post']))
|
||||||
{
|
{
|
||||||
$last_post_subject = censor_text($row['forum_last_post_subject']);
|
$last_post_subject = utf8_decode_ncr(censor_text($row['forum_last_post_subject']));
|
||||||
|
|
||||||
$last_post_subject_truncated = truncate_string($last_post_subject, 30, 255, false, $user->lang['ELLIPSIS']);
|
$last_post_subject_truncated = truncate_string($last_post_subject, 30, 255, false, $user->lang['ELLIPSIS']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1181,11 +1181,23 @@ if ($submit || $preview || $refresh)
|
||||||
$error[] = $user->lang['EMPTY_SUBJECT'];
|
$error[] = $user->lang['EMPTY_SUBJECT'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for out-of-bounds characters that are currently
|
/**
|
||||||
// not supported by utf8_bin in MySQL
|
* Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR.
|
||||||
|
* Using their Numeric Character Reference's Hexadecimal notation.
|
||||||
|
*/
|
||||||
|
$post_data['post_subject'] = utf8_encode_ucr($post_data['post_subject']);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This should never happen again.
|
||||||
|
* Leaving the fallback here just in case there will be the need of it.
|
||||||
|
*
|
||||||
|
* Check for out-of-bounds characters that are currently
|
||||||
|
* not supported by utf8_bin in MySQL
|
||||||
|
*/
|
||||||
if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $post_data['post_subject'], $matches))
|
if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $post_data['post_subject'], $matches))
|
||||||
{
|
{
|
||||||
$character_list = implode('<br />', $matches[0]);
|
$character_list = implode('<br>', $matches[0]);
|
||||||
|
|
||||||
$error[] = $user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list);
|
$error[] = $user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,15 +41,10 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
|
||||||
{
|
{
|
||||||
$this->login();
|
$this->login();
|
||||||
|
|
||||||
$this->add_lang('posting');
|
$post = $this->create_topic(2, "Test Topic \xF0\x9F\xA4\x94 3\xF0\x9D\x94\xBB\xF0\x9D\x95\x9A", 'This is a test with emoji character in the topic title.');
|
||||||
|
$this->create_post(2, $post['topic_id'], "Re: Test Topic 1 \xF0\x9F\xA4\x94 3\xF0\x9D\x94\xBB\xF0\x9D\x95\x9A", 'This is a test with emoji characters in the topic title.');
|
||||||
self::create_post(2,
|
$crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
|
||||||
1,
|
$this->assertContains("\xF0\x9F\xA4\x94 3\xF0\x9D\x94\xBB\xF0\x9D\x95\x9A", $crawler->text());
|
||||||
"Unsupported: \xF0\x9F\x88\xB3 \xF0\x9F\x9A\xB6",
|
|
||||||
'This is a test with emoji characters in the topic title.',
|
|
||||||
array(),
|
|
||||||
'Your subject contains the following unsupported characters'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_supported_unicode_characters()
|
public function test_supported_unicode_characters()
|
||||||
|
|
Loading…
Add table
Reference in a new issue