From 7655ad451ac8bc8a03bf84db643463de5d2f592c Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 1 Aug 2016 06:49:39 +0000 Subject: [PATCH] ConfigDiff: more context, fix diff with empty fixes #12262 fixes #12263 --- library/Director/ConfigDiff.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/library/Director/ConfigDiff.php b/library/Director/ConfigDiff.php index c1bb8192..0b82d230 100644 --- a/library/Director/ConfigDiff.php +++ b/library/Director/ConfigDiff.php @@ -22,10 +22,20 @@ class ConfigDiff { require_once dirname(__DIR__) . '/vendor/php-diff/lib/Diff.php'; - $this->a = explode("\n", (string) $a); - $this->b = explode("\n", (string) $b); + if (empty($a)) { + $this->a = array(); + } else { + $this->a = explode("\n", (string) $a); + } + + if (empty($b)) { + $this->b = array(); + } else { + $this->b = explode("\n", (string) $b); + } $options = array( + 'context' => 5, // 'ignoreWhitespace' => true, // 'ignoreCase' => true, );