diff --git a/lib/Diff/Renderer/Html/Array.php b/lib/Diff/Renderer/Html/Array.php
index 0b3f1d50..958c5f6d 100644
--- a/lib/Diff/Renderer/Html/Array.php
+++ b/lib/Diff/Renderer/Html/Array.php
@@ -177,7 +177,7 @@ private function formatLines($lines)
$lines = array_map(array($this, 'ExpandTabs'), $lines);
$lines = array_map(array($this, 'HtmlSafe'), $lines);
foreach($lines as &$line) {
- $line = preg_replace('# ( +)|^ #e', "\$this->fixSpaces('\\1')", $line);
+ $line = preg_replace_callback('# ( +)|^ #', array($this, 'fixSpaces'), $line);
}
return $lines;
}
@@ -185,12 +185,12 @@ private function formatLines($lines)
/**
* Replace a string containing spaces with a HTML representation using .
*
- * @param string $spaces The string of spaces.
+ * @param array $matches The string of spaces.
* @return string The HTML representation of the string.
*/
- function fixSpaces($spaces='')
+ function fixSpaces($matches)
{
- $count = strlen($spaces);
+ $count = strlen($matches[0]);
if($count == 0) {
return '';
}
@@ -221,4 +221,5 @@ private function htmlSafe($string)
{
return htmlspecialchars($string, ENT_NOQUOTES, 'UTF-8');
}
-}
\ No newline at end of file
+}
+