From 9c4a97c676cf85bb7af6d0742e6e986ff3a6e2c6 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sun, 2 Feb 2014 21:47:11 +0000 Subject: [PATCH] Throw an incorrect usage notice when the query argument of wpdb::prepare() does not include a placeholder. props ounziw. fixes #25604. Built from https://develop.svn.wordpress.org/trunk@27073 git-svn-id: http://core.svn.wordpress.org/trunk@26946 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/wp-db.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index cdea417c97..215494fe6e 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1053,6 +1053,10 @@ class wpdb { if ( is_null( $query ) ) return; + if ( strpos( $query, '%' ) === false ) { + _doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'wpdb::prepare()' ), '3.9' ); + } + $args = func_get_args(); array_shift( $args ); // If args were passed as an array (as in vsprintf), move them up