Automatically quote strings in $wpdb->prepare(). Use vsprintf(). see #4553

git-svn-id: http://svn.automattic.com/wordpress/trunk@5779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2007-07-05 17:32:46 +00:00
parent fbdfcce157
commit 45db1a512a
1 changed files with 3 additions and 1 deletions

View File

@ -132,8 +132,10 @@ class wpdb {
return;
$args = func_get_args();
$query = array_shift($args);
$query = str_replace("'%s'", '%s', $query); // in case someone mistakenly already quoted it
$query = str_replace('%s', "'%s'", $query); // quote the strings
array_walk($args, array(&$this, 'escape_by_ref'));
return @call_user_func_array('sprintf', array_merge(array($query), $args));
return @vsprintf($query, $args);
}
// ==================================================================