php-diff: fix callback for newer PHP versions

This commit is contained in:
Thomas Gelf 2016-03-03 01:22:19 +01:00
parent 505d3434a2
commit 204f4a662b
1 changed files with 8 additions and 1 deletions

View File

@ -176,12 +176,19 @@ class Diff_Renderer_Html_Array extends Diff_Renderer_Abstract
{
$lines = array_map(array($this, 'ExpandTabs'), $lines);
$lines = array_map(array($this, 'HtmlSafe'), $lines);
$callback = array($this, 'fixMatchedSpaces');
foreach($lines as &$line) {
$line = preg_replace('# ( +)|^ #e', "\$this->fixSpaces('\\1')", $line);
// $line = preg_replace('# ( +)|^ #e', "\$this->fixSpaces('\\1')", $line);
$line = preg_replace_callback('# ( +)|^ #', $callback, $line);
}
return $lines;
}
protected function fixMatchedSpaces($m)
{
return $this->fixSpaces($m[1]);
}
/**
* Replace a string containing spaces with a HTML representation using  .
*