Changeset 41662 for trunk/src/wp-includes/wp-db.php
- Timestamp:
- 10/02/2017 02:10:14 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/wp-db.php
r41660 r41662 1252 1252 $query = preg_replace( '|(?<!%)%f|' , '%F', $query ); // Force floats to be locale unaware 1253 1253 $query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s 1254 $query = preg_replace( '/%(?:%|$|([^dsF]))/', '%%\\1', $query ); // escape any unescaped percents 1254 $query = preg_replace( '/%(?:%|$|([^dsF]))/', '%%\\1', $query ); // escape any unescaped percents 1255 1256 // Count the number of valid placeholders in the query 1257 $placeholders = preg_match_all( '/(^|[^%]|(%%)+)%[sdF]/', $query ); 1258 1259 if ( count ( $args ) !== $placeholders ) { 1260 _doing_it_wrong( 'wpdb::prepare', 1261 sprintf( __( 'The query does not contain the correct number of placeholders (%d) for the number of arguments passed (%d).' ), 1262 $placeholders, 1263 count( $args ) ), 1264 '4.9.0' 1265 ); 1266 } 1267 1255 1268 array_walk( $args, array( $this, 'escape_by_ref' ) ); 1256 1269 return @vsprintf( $query, $args ); … … 2047 2060 2048 2061 $sql = "UPDATE `$table` SET $fields WHERE $conditions"; 2049 2062 2050 2063 $this->check_current_query = false; 2051 2064 return $this->query( $this->prepare( $sql, $values ) );
Note: See TracChangeset
for help on using the changeset viewer.