Index: branches/RC/core/kernel/db/dbitem.php =================================================================== diff -u -N -r11361 -r11362 --- branches/RC/core/kernel/db/dbitem.php (.../dbitem.php) (revision 11361) +++ branches/RC/core/kernel/db/dbitem.php (.../dbitem.php) (revision 11362) @@ -617,13 +617,17 @@ foreach($unique_fields as $unique_field) { // if field is not empty or if it is required - we add where condition - if ($this->GetDBField($unique_field) != '' || (isset($this->Fields[$unique_field]['required']) && $this->Fields[$unique_field]['required'])) { + if ((string)$this->GetDBField($unique_field) != '' || (isset($this->Fields[$unique_field]['required']) && $this->Fields[$unique_field]['required'])) { $where[] = '`'.$unique_field.'` = '.$this->Conn->qstr( $this->GetDBField($unique_field) ); } + else { + // not good if we check by less fields than indicated + return true; + } } // This can ONLY happen if all unique fields are empty and not required. // In such case we return true, because if unique field is not required there may be numerous empty values - if (!$where) return true; +// if (!$where) return true; $sql = 'SELECT COUNT(*) FROM %s WHERE ('.implode(') AND (',$where).') AND ('.$this->IDField.' <> '.(int)$this->ID.')';