diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1c516078dd4..0693b3dd336 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4207,7 +4207,7 @@ abstract class CommonObject if (! is_array($optionsArray)) { - // $extrafields is not a known object, we initialize it. Best practice is to have $extrafields defined into card.php or list.php page. + // If $extrafields is not a known object, we initialize it. Best practice is to have $extrafields defined into card.php or list.php page. // TODO Use of existing extrafield is not yet ready (must mutualize code that use extrafields in form first) // global $extrafields; //if (! is_object($extrafields)) @@ -4228,7 +4228,7 @@ abstract class CommonObject if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility // Request to get complementary values - if (count($optionsArray) > 0) + if (is_array($optionsArray) && count($optionsArray) > 0) { $sql = "SELECT rowid"; foreach ($optionsArray as $name => $label)