Browse Source

Invalid argument for foreach fixed

Cf. https://github.com/ldleman/Leed/issues/305#issuecomment-34576716
Phyks 5 years ago
parent
commit
9cfb085eac
1 changed files with 6 additions and 1 deletions
  1. 6 1
      Plugin.class.php

+ 6 - 1
Plugin.class.php

@@ -46,6 +46,9 @@ class Plugin{
     }
     public static function pruneStates() {
         $statesBefore = self::getStates();
+        if(empty($statesBefore))
+            $statesBefore = array();
+
         $statesAfter = array();
         $error = false;
         if (is_array($statesBefore))
@@ -183,7 +186,9 @@ class Plugin{
     public static function getFiles($onlyActivated=false){
 
         $enabled = $disabled =  array();
-        $files = glob(dirname(__FILE__). Plugin::FOLDER .'/*/*.plugin.*.php') or array();
+        $files = glob(dirname(__FILE__). Plugin::FOLDER .'/*/*.plugin.*.php');
+        if(empty($files))
+            $files = array();
 
         foreach($files as $file){
             $plugin = Plugin::getObject($file);