diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 11c9ea88c1..e6d973c7f3 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -533,6 +533,15 @@ function bbencode_second_pass_code($text, $uid, $bbcode_tpl) $after_replace = $matches[1][$i]; $after_replace = preg_replace($html_entities_match, $html_entities_replace, $after_replace); + + // Replace all spaces with non-breaking spaces. + $after_replace = str_replace(" ", " ", $after_replace); + + // Replace 3 nbsp's with "   " so non-tabbed code indents without making huge long lines. + $after_replace = str_replace("   ", "   ", $after_replace); + + // Replace tabs with "   " so tabbed code indents sorta right without making huge long lines. + $after_replace = str_replace("\t", "   ", $after_replace); $str_to_match = "[code:1:$uid]" . $before_replace . "[/code:1:$uid]";