Changeset 45630
- Timestamp:
- 07/12/2019 12:16:34 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/wp-db.php
r45611 r45630 1268 1268 * %s (string) 1269 1269 * 1270 * All placeholders MUST be left unquoted in the query string. A corresponding argument MUST be passed for each placeholder. 1271 * 1272 * For compatibility with old behavior, numbered or formatted string placeholders (eg, %1$s, %5s) will not have quotes 1273 * added by this function, so should be passed with appropriate quotes around them for your usage. 1270 * All placeholders MUST be left unquoted in the query string. A corresponding argument 1271 * MUST be passed for each placeholder. 1272 * 1273 * For compatibility with old behavior, numbered or formatted string placeholders (eg, %1$s, %5s) 1274 * will not have quotes added by this function, so should be passed with appropriate quotes around 1275 * them for your usage. 1274 1276 * 1275 1277 * Literal percentage signs (%) in the query string must be written as %%. Percentage wildcards (for example, … … 1277 1279 * cannot be inserted directly in the query string. Also see wpdb::esc_like(). 1278 1280 * 1279 * Arguments may be passed as individual arguments to the method, or as a single array containing all arguments. A combination1280 * of the two is not supported.1281 * Arguments may be passed as individual arguments to the method, or as a single array containing 1282 * all arguments. A combination of the two is not supported. 1281 1283 * 1282 1284 * Examples: … … 1288 1290 * 1289 1291 * @param string $query Query statement with sprintf()-like placeholders 1290 * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called with an array of arguments, 1291 * or the first variable to substitute into the query's placeholders if being called with individual arguments. 1292 * @param mixed ...$args further variables to substitute into the query's placeholders if being called wih individual arguments. 1292 * @param array|mixed $args The array of variables to substitute into the query's placeholders 1293 * if being called with an array of arguments, or the first variable 1294 * to substitute into the query's placeholders if being called with 1295 * individual arguments. 1296 * @param mixed ...$args Further variables to substitute into the query's placeholders 1297 * if being called with individual arguments. 1293 1298 * @return string|void Sanitized query string, if there is a query to prepare. 1294 1299 */ 1295 public function prepare( $query, $args ) {1300 public function prepare( $query, ...$args ) { 1296 1301 if ( is_null( $query ) ) { 1297 1302 return; … … 1303 1308 _doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'wpdb::prepare()' ), '3.9.0' ); 1304 1309 } 1305 1306 $args = func_get_args();1307 array_shift( $args );1308 1310 1309 1311 // If args were passed as an array (as in vsprintf), move them up.
Note: See TracChangeset
for help on using the changeset viewer.