mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Database: Restore numbered placeholders in wpdb::prepare().
[41496] removed support for numbered placeholders in queries send through `wpdb::prepare()`, which, despite being undocumented, were quite commonly used. This change restores support for numbered placeholders (as well as a subset of placeholder formatting), while also adding extra checks to ensure the correct number of arguments are being passed to `wpdb::prepare()`, given the number of placeholders. See #41925. git-svn-id: https://develop.svn.wordpress.org/trunk@42056 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1218,22 +1218,24 @@ class Tests_Comment_Query extends WP_UnitTestCase {
|
||||
* @ticket 35513
|
||||
*/
|
||||
public function test_search_int_0_should_not_be_ignored() {
|
||||
global $wpdb;
|
||||
$q = new WP_Comment_Query();
|
||||
$q->query( array(
|
||||
'search' => 0,
|
||||
) );
|
||||
$this->assertContains( "comment_author LIKE '%0%'", $q->request );
|
||||
$this->assertContains( "comment_author LIKE '%0%'", $wpdb->remove_placeholder_escape( $q->request ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35513
|
||||
*/
|
||||
public function test_search_string_0_should_not_be_ignored() {
|
||||
global $wpdb;
|
||||
$q = new WP_Comment_Query();
|
||||
$q->query( array(
|
||||
'search' => '0',
|
||||
) );
|
||||
$this->assertContains( "comment_author LIKE '%0%'", $q->request );
|
||||
$this->assertContains( "comment_author LIKE '%0%'", $wpdb->remove_placeholder_escape( $q->request ) );
|
||||
}
|
||||
|
||||
public function test_orderby_default() {
|
||||
|
||||
Reference in New Issue
Block a user