aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2014-06-10 15:51:25 +0200
committerMarc Alexander <admin@m-a-styles.de>2014-06-10 15:51:25 +0200
commit5ee7f20f4ee110c2ae0b122e9efbd4fabf669581 (patch)
treea1f913af3a36ad324ebb59ef6defc83fd7b73386
parent65884bf2bd754343410a5b3d8b4eea2343dc42e9 (diff)
downloadforums-5ee7f20f4ee110c2ae0b122e9efbd4fabf669581.tar
forums-5ee7f20f4ee110c2ae0b122e9efbd4fabf669581.tar.gz
forums-5ee7f20f4ee110c2ae0b122e9efbd4fabf669581.tar.bz2
forums-5ee7f20f4ee110c2ae0b122e9efbd4fabf669581.tar.xz
forums-5ee7f20f4ee110c2ae0b122e9efbd4fabf669581.zip
[ticket/11711] Improve coding and comments of character check
PHPBB3-11711
-rw-r--r--phpBB/includes/message_parser.php2
-rw-r--r--phpBB/posting.php2
-rw-r--r--tests/functional/posting_test.php6
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php17
4 files changed, 16 insertions, 11 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 8965b50667..9d95620e0f 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1195,7 +1195,7 @@ class parse_message extends bbcode_firstpass
}
// Check for out-of-bounds characters that are currently
- // not supported by utf8_bin
+ // not supported by utf8_bin in MySQL
if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $this->message, $matches))
{
$character_list = implode('<br />', $matches[0]);
diff --git a/phpBB/posting.php b/phpBB/posting.php
index fc407caf69..17eac71bd3 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -1029,7 +1029,7 @@ if ($submit || $preview || $refresh)
}
// Check for out-of-bounds characters that are currently
- // not supported by utf8_bin
+ // not supported by utf8_bin in MySQL
if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $post_data['post_subject'], $matches))
{
$character_list = implode('<br />', $matches[0]);
diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php
index b0a2f069e1..fd802eed45 100644
--- a/tests/functional/posting_test.php
+++ b/tests/functional/posting_test.php
@@ -48,13 +48,15 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
'Unsupported characters',
"This is a test with these weird characters: \xF0\x9F\x88\xB3 \xF0\x9F\x9A\xB6",
array(),
- 'Your message contains the following unsupported characters');
+ 'Your message contains the following unsupported characters'
+ );
self::create_post(2,
1,
"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');
+ 'Your subject contains the following unsupported characters'
+ );
}
}
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index c0127c50c9..f2c2c8f181 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -996,16 +996,19 @@ class phpbb_functional_test_case extends phpbb_test_case
// Instead, I send it as a request with the submit button "post" set to true.
$crawler = self::request('POST', $posting_url, $form_data);
- if ($expected !== '' && isset($this->lang[$expected]))
+ if ($expected !== '')
{
- $this->assertContainsLang($expected, $crawler->filter('html')->text());
- return null;
- }
- else if ($expected !== '')
- {
- $this->assertContains($expected, $crawler->filter('html')->text());
+ if (isset($this->lang[$expected]))
+ {
+ $this->assertContainsLang($expected, $crawler->filter('html')->text());
+ }
+ else
+ {
+ $this->assertContains($expected, $crawler->filter('html')->text());
+ }
return null;
}
+
$url = $crawler->selectLink($form_data['subject'])->link()->getUri();
return array(