From e5d23b93cfa0d9f967e0c7a6a239b93a1205cc1f Mon Sep 17 00:00:00 2001 From: Alexandros Sigalas Date: Tue, 5 Mar 2019 08:51:22 +0200 Subject: [PATCH] Fixed, PHP Warning: Invalid argument supplied for foreach() in ... --- api/src/Db/Schema.php | 20 ++++++++++++------- .../inc/class.importexport_definition.inc.php | 13 ++++++++---- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/api/src/Db/Schema.php b/api/src/Db/Schema.php index 8d67f133ce..06b8987d86 100644 --- a/api/src/Db/Schema.php +++ b/api/src/Db/Schema.php @@ -165,16 +165,22 @@ class Schema $columns = implode('-',$columns); if ($ignore_length_limit) $columns = preg_replace('/\(\d+\)/', '', $columns); } - foreach($indexs as $index) - { - if (is_array($index)) + + if(is_array($indexs)){ + + foreach($indexs as $index) { - unset($index['options']); - $index = implode('-',$index); + if (is_array($index)) + { + unset($index['options']); + $index = implode('-',$index); + } + if ($ignore_length_limit) $index = preg_replace('/\(\d+\)/', '', $index); + if ($columns == $index) return true; } - if ($ignore_length_limit) $index = preg_replace('/\(\d+\)/', '', $index); - if ($columns == $index) return true; + } + return false; } diff --git a/importexport/inc/class.importexport_definition.inc.php b/importexport/inc/class.importexport_definition.inc.php index 5f61efbfe5..80187dedfa 100644 --- a/importexport/inc/class.importexport_definition.inc.php +++ b/importexport/inc/class.importexport_definition.inc.php @@ -180,11 +180,16 @@ class importexport_definition implements importexport_iface_egw_record { */ private function set_options(array $_plugin_options) { // Check conditions - foreach ( $_plugin_options['conditions'] as $key => $condition ) { - if(!$condition['string']) - { - unset($_plugin_options['conditions'][$key]); + + if (is_array($_plugin_options['conditions'] )){ + + foreach ( $_plugin_options['conditions'] as $key => $condition ) { + if(!$condition['string']) + { + unset($_plugin_options['conditions'][$key]); + } } + } $this->definition['plugin_options'] = $_plugin_options; }