From 5398a9fceb822eaae1827079b0c762483244bd91 Mon Sep 17 00:00:00 2001 From: ebo Date: Mon, 25 Apr 2016 08:35:23 +0100 Subject: [PATCH] preg_replace e modifier deprecated in PHP 7.0 --- lib/Diff/Renderer/Html/Array.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Diff/Renderer/Html/Array.php b/lib/Diff/Renderer/Html/Array.php index b012fb6b..89ca016e 100644 --- a/lib/Diff/Renderer/Html/Array.php +++ b/lib/Diff/Renderer/Html/Array.php @@ -177,7 +177,7 @@ protected 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; } @@ -188,8 +188,9 @@ protected function formatLines($lines) * @param string $spaces The string of spaces. * @return string The HTML representation of the string. */ - function fixSpaces($spaces='') + function fixSpaces($matches) { + $spaces=$matches[1]; $count = strlen($spaces); if($count == 0) { return ''; @@ -222,3 +223,4 @@ private function htmlSafe($string) return htmlspecialchars($string, ENT_NOQUOTES, 'UTF-8'); } } +