From: Sam Reed Date: Wed, 24 Aug 2011 21:38:31 +0000 (+0000) Subject: Allow update to be passed an empty array for the WHERE condition X-Git-Tag: 1.31.0-rc.0~28084 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=87f03bf97e0ced5eef77b84a67d657085499ffab;p=lhc%2Fweb%2Fwiklou.git Allow update to be passed an empty array for the WHERE condition --- diff --git a/includes/db/Database.php b/includes/db/Database.php index 279948fb37..fd1415389b 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1693,7 +1693,7 @@ abstract class DatabaseBase implements DatabaseType { $opts = $this->makeUpdateOptions( $options ); $sql = "UPDATE $opts $table SET " . $this->makeList( $values, LIST_SET ); - if ( $conds != '*' ) { + if ( $conds != '*' || ( is_array( $conds ) && count( $conds ) ) ) { $sql .= " WHERE " . $this->makeList( $conds, LIST_AND ); } diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 70f76b6ded..23e449ac7f 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -1194,7 +1194,7 @@ class DatabaseOracle extends DatabaseBase { $sql .= $sqlSet; } - if ( $conds != '*' ) { + if ( $conds != '*' || ( is_array( $conds ) && count( $conds ) ) ) { $conds = $this->wrapConditionsForWhere( $table, $conds ); $sql .= ' WHERE ' . $this->makeList( $conds, LIST_AND ); }