Automatically quote strings in $wpdb->prepare(). Use vsprintf(). see #4553
git-svn-id: https://develop.svn.wordpress.org/trunk@5779 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b0b9c7946b
commit
0ccba3e8bb
@ -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);
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user