Make WordPress Core


Ignore:
Timestamp:
10/31/2017 11:59:43 AM (7 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.

See #41925.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r41849 r42056  
    43184318    $page_path = str_replace('%20', ' ', $page_path);
    43194319    $parts = explode( '/', trim( $page_path, '/' ) );
    4320     $parts = esc_sql( $parts );
    43214320    $parts = array_map( 'sanitize_title_for_query', $parts );
    4322 
    4323     $in_string = "'" . implode( "','", $parts ) . "'";
     4321    $escaped_parts = esc_sql( $parts );
     4322
     4323    $in_string = "'" . implode( "','", $escaped_parts ) . "'";
    43244324
    43254325    if ( is_array( $post_type ) ) {
Note: See TracChangeset for help on using the changeset viewer.