Make WordPress Core


Ignore:
Timestamp:
10/31/2017 12:54:43 PM (8 years ago)
Author:
pento
Message:

Database: Restore numbered placeholders in wpdb::prepare().

[41496] removed support for numbered placeholders in queries send through wpdb::prepare(), which, despite being undocumented, were quite commonly used.

This change restores support for numbered placeholders (as well as a subset of placeholder formatting), while also adding extra checks to ensure the correct number of arguments are being passed to wpdb::prepare(), given the number of placeholders.

Merges [41662], [42056] to the 4.0 branch.
See #41925.

Location:
branches/4.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0

  • branches/4.0/tests/phpunit/includes/testcase.php

    r41085 r42065  
    205205            $this->fail( "Unexpected incorrect usage notice for $unexpected" );
    206206        }
     207    }
     208
     209    /**
     210     * Declare an expected `_doing_it_wrong()` call from within a test.
     211     *
     212     * @since 4.2.0
     213     *
     214     * @param string $deprecated Name of the function, method, or class that appears in the first argument of the
     215     *                           source `_doing_it_wrong()` call.
     216     */
     217    public function setExpectedIncorrectUsage( $doing_it_wrong ) {
     218        array_push( $this->expected_doing_it_wrong, $doing_it_wrong );
    207219    }
    208220
Note: See TracChangeset for help on using the changeset viewer.