Make WordPress Core


Ignore:
Timestamp:
06/10/2014 12:29:35 AM (11 years ago)
Author:
wonderboymusic
Message:

LIKE escape sanity:

  • Deprecate like_escape()
  • Add a method to $wpdb, ->esc_like(), and add unit tests

$wpdb::esc_like() is not used yet. As such, many unit tests will throw Unexpected deprecated notice for like_escape. Subsequent commits will alleviate this.

Props miqrogroove.
See #10041.

File:
1 edited

Legend:

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

    r28710 r28711  
    34603460
    34613461/**
     3462 * Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described.
     3463 *
     3464 * @since 2.5.0
     3465 * @deprecated 4.0.0
     3466 * @deprecated Use wpdb::esc_like()
     3467 *
     3468 * @param string $text The text to be escaped.
     3469 * @return string text, safe for inclusion in LIKE query.
     3470 */
     3471function like_escape($text) {
     3472    _deprecated_function( __FUNCTION__, '4.0', 'wpdb::esc_like()' );
     3473    return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text );
     3474}
     3475
     3476/**
    34623477 * Determines if the URL can be accessed over SSL.
    34633478 *
Note: See TracChangeset for help on using the changeset viewer.