diff --git a/lib/exception/sfException.class.php b/lib/exception/sfException.class.php index 19fd9d950..31dfcfa2c 100644 --- a/lib/exception/sfException.class.php +++ b/lib/exception/sfException.class.php @@ -329,7 +329,10 @@ protected static function fileExcerpt($file, $line) } if (is_readable($file)) { - $content = preg_split('#
#', preg_replace('/^(.*)<\/code>$/s', '$1', highlight_file($file, true))); + $replaceRegex = '/^(?:
]+)?>|]+)?>\s*)(.*?)(?:<\/code><\/pre>|\s*<\/span>\s*<\/code>)$/s';
+            $splitRegex = '/(\r\n|\n|\r|
)/'; + + $content = preg_split($splitRegex, preg_replace($replaceRegex, '$1', highlight_file($file, true))); $lines = []; for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) {