From 53f1ba51e4c0c31d9995fc7064d1e912fb1c8501 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 2 Sep 2014 04:56:15 +0000 Subject: [PATCH] DB: Revert [28814] and require a WHERE for wpdb::update(). see #26106. Built from https://develop.svn.wordpress.org/trunk@29664 git-svn-id: http://core.svn.wordpress.org/trunk@29438 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/wp-db.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 08a6b8c72f..f30ad79146 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1793,9 +1793,7 @@ class wpdb { $wheres[] = "`$field` = {$form}"; } - $wheres = empty( $where ) ? '' : ( ' WHERE ' . implode( ' AND ', $wheres ) ); - - $sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . $wheres; + $sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres ); return $this->query( $this->prepare( $sql, array_merge( array_values( $data ), array_values( $where ) ) ) ); }