WordPress.org

Make WordPress Core

Changeset 22429


Ignore:
Timestamp:
11/07/12 19:30:59 (18 months ago)
Author:
nacin
Message:

Enforce a minimum of two arguments for wpdb::prepare(). The first argument is the query (or fragment thereof), which is required. Additional arguments are values to substitute into placeholders.

This will generate E_WARNINGs for insufficient arguments when prepare() is called with no additional arguments. This should discourage improper uses of prepare() under the guise of safely running a query.

props xknown. fixes #22262.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/wp-db.php

    r22304 r22429  
    988988     *  if there was something to prepare 
    989989     */ 
    990     function prepare( $query = null ) { // ( $query, *$args ) 
     990    function prepare( $query, $args ) { 
    991991        if ( is_null( $query ) ) 
    992992            return; 
Note: See TracChangeset for help on using the changeset viewer.