From c8089f97d88baa685efef18342aafe9277482ddb Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Thu, 17 Aug 2017 12:55:27 +0200 Subject: [PATCH] Prevent notice when no rules Closes https://github.com/PHPOffice/PHPExcel/pull/1287 --- src/PhpSpreadsheet/Worksheet/AutoFilter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter.php b/src/PhpSpreadsheet/Worksheet/AutoFilter.php index 88042565..c3d783da 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter.php @@ -629,6 +629,7 @@ class AutoFilter $rules = $filterColumn->getRules(); switch ($filterColumn->getFilterType()) { case AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER: + $ruleType = null; $ruleValues = []; // Build a list of the filter value selections foreach ($rules as $rule) { @@ -700,7 +701,6 @@ class AutoFilter $ruleValues = []; // Build a list of the filter value selections foreach ($rules as $rule) { - $ruleType = $rule->getRuleType(); $ruleValue = $rule->getValue(); if (!is_numeric($ruleValue)) { // Convert to a regexp allowing for regexp reserved characters, wildcards and escaped wildcards