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/src/wp-includes/formatting.php

    r41201 r42057  
    37393739 * is preparing an array for use in an IN clause.
    37403740 *
     3741 * NOTE: Since 4.8.3, '%' characters will be replaced with a placeholder string,
     3742 * this prevents certain SQLi attacks from taking place. This change in behaviour
     3743 * may cause issues for code that expects the return value of esc_sql() to be useable
     3744 * for other purposes.
     3745 *
    37413746 * @since 2.8.0
    37423747 *
Note: See TracChangeset for help on using the changeset viewer.