diff --git a/dblayeroo.php b/dblayeroo.php index e929a29..27069f3 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -2184,10 +2184,11 @@ class dblayeroo // - Check the unique entries (if defined) // The primary key is always unique : add it if not set by the user $this->debugLog (" verify the unique constraint"); - if (! in_array ($this->primary, $this->unique)) - $uniques = array_merge (array ($this->primary), $this->unique); - else - $uniques = $this->unique; + $uniques = $this->unique; + if (! is_array ($uniques)) + $uniques = array (); + if (! in_array ($this->primary, $uniques)) + $uniques = array_merge (array ($this->primary), $uniques); $setValues = $values; if (! array_key_exists ($this->primary, $setValues)) $setValues[$this->primary] = null;