Make WordPress Core


Ignore:
Timestamp:
07/16/2013 05:44:42 PM (12 years ago)
Author:
nacin
Message:

Deprecate wpdb::escape() in favor of wpdb::prepare() and esc_sql(). fixes #24774.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/formatting.php

    r24683 r24718  
    25922592
    25932593/**
    2594  * Escapes data for use in a MySQL query
    2595  *
    2596  * This is just a handy shortcut for $wpdb->escape(), for completeness' sake
     2594 * Escapes data for use in a MySQL query.
     2595 *
     2596 * Usually you should prepare queries using wpdb::prepare().
     2597 * Sometimes, spot-escaping is required or useful. One example
     2598 * is preparing an array for use in an IN clause.
    25972599 *
    25982600 * @since 2.8.0
    2599  * @param string $sql Unescaped SQL data
    2600  * @return string The cleaned $sql
    2601  */
    2602 function esc_sql( $sql ) {
     2601 * @param string $data Unescaped data
     2602 * @return string Escaped data
     2603 */
     2604function esc_sql( $data ) {
    26032605    global $wpdb;
    2604     return $wpdb->escape( $sql );
     2606    return $wpdb->_escape( $data );
    26052607}
    26062608
Note: See TracChangeset for help on using the changeset viewer.