Make WordPress Core


Ignore:
Timestamp:
10/31/2017 12:22:07 PM (9 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.8 branch.
See #41925.

Location:
branches/4.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8

  • branches/4.8/tests/phpunit/tests/rest-api/rest-posts-controller.php

    r40605 r42057  
    8686                $expected_clause = str_replace( '{posts}', $wpdb->posts, $pattern );
    8787                $this->assertCount( 1, $this->posts_clauses );
    88                 $this->assertEquals( $expected_clause, $this->posts_clauses[0][ $clause ] );
     88                $this->assertEquals( $expected_clause, $wpdb->remove_placeholder_escape( $this->posts_clauses[0][ $clause ] ) );
    8989        }
    9090
Note: See TracChangeset for help on using the changeset viewer.