diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 36c52a23c8..677ace42fe 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -127,6 +127,7 @@
[Change] Use correct string for filesize (MiB instead of MB for example)
[Change] Remove left join for query used to retrieve already assigned users and groups within permission panel (Bug #20235)
[Fix] Correctly return sole whitespaces if used with BBCodes (Bug #19535)
+ [Fix] Quote bbcode parsing adding too much closing tags on special conditions (Bug #20735)
1.i. Changes since 3.0.RC8
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index e78fc271a6..41e7bc51d7 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -684,7 +684,8 @@ class bbcode_firstpass extends bbcode
* #14667 - [quote]test[/quote] test ] and [ test [quote]test[/quote] (correct: parsed)
* #14770 - [quote="["]test[/quote] (correct: parsed)
* [quote="[i]test[/i]"]test[/quote] (correct: parsed)
- * [quote="[quote]test[/quote]"]test[/quote] (correct: NOT parsed)
+ * [quote="[quote]test[/quote]"]test[/quote] (correct: parsed - Username displayed as [quote]test[/quote])
+ * #20735 - [quote]test[/[/b]quote] test [/quote][/quote] test - (correct: quoted: "test[/[/b]quote] test" / non-quoted: "[/quote] test" - also failed if layout distorted)
*/
$in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in)));
@@ -737,7 +738,7 @@ class bbcode_firstpass extends bbcode
$out .= ' ';
}*/
}
- else if (preg_match('#^quote(?:="(.*?)")?$#is', $buffer, $m))
+ else if (preg_match('#^quote(?:="(.*?)")?$#is', $buffer, $m) && substr($out, -1, 1) == '[')
{
$this->parsed_items['quote']++;