Bug fix: fixing php error from foreach not having an array
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 24 Jun 2016 16:11:33 +0000 (12:11 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 24 Jun 2016 16:11:33 +0000 (12:11 -0400)
Checking the $packages first to see if it is an array.

setup/shortcodeBuilder.php

index 44d14ae..8fa97d9 100644 (file)
     $package = new GlmDataPackages($this->wpdb, $this->config);
     $packageList = $package->getList();
 
-    foreach($packageList as $key=>$value){
-        $packageListId[] = $value['id'];
+    if ( isset( $packageList ) && is_array( $packageList ) ) {
+        foreach($packageList as $key=>$value){
+            $packageListId[] = $value['id'];
+        }
     }
     
     // loop through packaging list shortcode attributes