diff options
| author | Marc Alexander <admin@m-a-styles.de> | 2017-11-26 18:33:54 +0100 |
|---|---|---|
| committer | Marc Alexander <admin@m-a-styles.de> | 2017-11-26 18:33:54 +0100 |
| commit | 81a71f71c72514dfd50afa48c49cc0c355d70e69 (patch) | |
| tree | ff55b102dd0f8a75d34f6e40f9d8be8fb3834ca7 | |
| parent | 85ece822db5c73b17a29764d334b910bbd1dfa24 (diff) | |
| parent | a7664811dd3696e17a78fd98fec49f9beaf4579d (diff) | |
| download | forums-81a71f71c72514dfd50afa48c49cc0c355d70e69.tar forums-81a71f71c72514dfd50afa48c49cc0c355d70e69.tar.gz forums-81a71f71c72514dfd50afa48c49cc0c355d70e69.tar.bz2 forums-81a71f71c72514dfd50afa48c49cc0c355d70e69.tar.xz forums-81a71f71c72514dfd50afa48c49cc0c355d70e69.zip | |
Merge pull request #5051 from JoshyPHP/ticket/15464
[ticket/15464] Detect BBCodes in uppercase when reparsing
| -rw-r--r-- | phpBB/phpbb/textreparser/base.php | 4 | ||||
| -rw-r--r-- | tests/text_reparser/base_test.php | 15 | ||||
| -rw-r--r-- | tests/text_reparser/fixtures/base.xml | 8 |
3 files changed, 25 insertions, 2 deletions
diff --git a/phpBB/phpbb/textreparser/base.php b/phpBB/phpbb/textreparser/base.php index 27d7bc1f27..2ee6ea2cb3 100644 --- a/phpBB/phpbb/textreparser/base.php +++ b/phpBB/phpbb/textreparser/base.php @@ -153,8 +153,8 @@ abstract class base implements reparser_interface { // Look for the closing tag inside of a e element, in an element of the same name, e.g. // <e>[/url]</e></URL> - $match = '<e>[/' . $bbcode . ']</e></' . strtoupper($bbcode) . '>'; - if (strpos($record['text'], $match) !== false) + $match = '<e>[/' . $bbcode . ']</e></' . $bbcode . '>'; + if (stripos($record['text'], $match) !== false) { return true; } diff --git a/tests/text_reparser/base_test.php b/tests/text_reparser/base_test.php index af2d56ea51..2c6844b063 100644 --- a/tests/text_reparser/base_test.php +++ b/tests/text_reparser/base_test.php @@ -66,4 +66,19 @@ class phpbb_textreparser_base_test extends phpbb_database_test_case $this->get_rows(array(1)) ); } + + public function test_reparse_case_insensitive() + { + $this->get_reparser()->reparse_range(2, 2); + + $this->assertEquals( + [ + [ + 'id' => '2', + 'text' => '<r><IMG src="img.png"><s>[IMG]</s>img.png<e>[/IMG]</e></IMG></r>' + ] + ], + $this->get_rows([2]) + ); + } } diff --git a/tests/text_reparser/fixtures/base.xml b/tests/text_reparser/fixtures/base.xml index a4921a8823..532a19a8a9 100644 --- a/tests/text_reparser/fixtures/base.xml +++ b/tests/text_reparser/fixtures/base.xml @@ -15,5 +15,13 @@ <value></value> <value>abcd1234</value> </row> + <row> + <value>2</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value><![CDATA[<r><IMG src="img.png"><s>[IMG]</s>img.png<e>[/IMG]</e></IMG></r>]]></value> + <value></value> + </row> </table> </dataset> |
