mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
In $wpdb->update()
, prevent explosions when $where
is empty.
Adds unit tests. Props UmeshSingla, wonderboymusic. Fixes #26106 Built from https://develop.svn.wordpress.org/trunk@28814 git-svn-id: http://core.svn.wordpress.org/trunk@28621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
919ff69120
commit
3ebd519a3e
@ -1785,7 +1785,9 @@ class wpdb {
|
|||||||
$wheres[] = "`$field` = {$form}";
|
$wheres[] = "`$field` = {$form}";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres );
|
$wheres = empty( $where ) ? '' : ( ' WHERE ' . implode( ' AND ', $wheres ) );
|
||||||
|
|
||||||
|
$sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . $wheres;
|
||||||
return $this->query( $this->prepare( $sql, array_merge( array_values( $data ), array_values( $where ) ) ) );
|
return $this->query( $this->prepare( $sql, array_merge( array_values( $data ), array_values( $where ) ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user