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
This commit is contained in:
Andrew Nacin 2012-12-27 16:44:17 +00:00
parent 20340a01db
commit 93a78f57b4
1 changed files with 4 additions and 1 deletions

View File

@ -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