Skip to content

Commit 687184d

Browse files
committed
Fixed null parameter warning
1 parent f21a8e8 commit 687184d

File tree

1 file changed

+9
-14
lines changed
  • app/code/community/Fballiano/ImageCleaner/Helper

1 file changed

+9
-14
lines changed

app/code/community/Fballiano/ImageCleaner/Helper/Data.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
<?php
2-
32
/**
4-
* FBalliano
5-
*
6-
* NOTICE OF LICENSE
7-
*
83
* This source file is subject to the Open Software License (OSL 3.0)
94
* that is bundled with this package in the file LICENSE.txt.
105
* It is also available through the world-wide-web at this URL:
116
* http://opensource.org/licenses/osl-3.0.php
127
*
13-
* DISCLAIMER
14-
*
15-
* Do not edit or add to this file if you wish to upgrade this Module to
16-
* newer versions in the future.
17-
*
188
* @category FBalliano
199
* @package FBalliano_ImageCleaner
20-
* @copyright Copyright (c) 2021 Fabrizio Balliano (http://fabrizioballiano.it)
10+
* @copyright Copyright (c) Fabrizio Balliano (http://fabrizioballiano.com)
2111
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
2212
*/
2313
class Fballiano_ImageCleaner_Helper_Data extends Mage_Core_Helper_Abstract
@@ -83,12 +73,17 @@ public function getAllCSSFiles($dir)
8373
return $result;
8474
}
8575

86-
protected function getBlacklistedPatterns()
76+
protected function getBlacklistedPatterns(): array
8777
{
88-
return preg_split('/\r\n|\r|\n/', Mage::getStoreConfig('admin/fb_image_cleaner/blacklist'));
78+
$blacklist = Mage::getStoreConfig('admin/fb_image_cleaner/blacklist');
79+
if ($blacklist === null) {
80+
return [];
81+
}
82+
83+
return preg_split('/\r\n|\r|\n/', $blacklist);
8984
}
9085

91-
public function isBlacklisted($path, $blacklisted_patterns)
86+
public function isBlacklisted($path, $blacklisted_patterns): bool
9287
{
9388
foreach ($blacklisted_patterns as $blacklisted_pattern) {
9489
if (fnmatch('*/' . $blacklisted_pattern, $path)) return true;

0 commit comments

Comments
 (0)