From 93a78f57b494293f8d2a5869694dd13bdcf70903 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 27 Dec 2012 16:44:17 +0000 Subject: [PATCH] In 3.5.1, have $wpdb->prepare() issue a notice for an insufficient number of arguments, instead of a warning. see #22873. git-svn-id: http://core.svn.wordpress.org/branches/3.5@23215 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/wp-db.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 391cfa4dc9..e0b2009a11 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -987,10 +987,13 @@ class wpdb { * @return null|false|string Sanitized query string, null if there is no query, false if there is an error and string * if there was something to prepare */ - function prepare( $query, $args ) { + function prepare( $query, $args = null ) { if ( is_null( $query ) ) return; + if ( func_num_args() < 2 ) + _doing_it_wrong( 'wpdb::prepare', sprintf( 'wpdb::prepare() requires at least two arguments.' ), '3.5' ); + $args = func_get_args(); array_shift( $args ); // If args were passed as an array (as in vsprintf), move them up