Make WordPress Core


Ignore:
Timestamp:
07/16/2013 02:07:53 PM (12 years ago)
Author:
nacin
Message:

Always use mysql_real_escape_string(), even when DB_CHARSET is not properly set. fixes #24773.

File:
1 edited

Legend:

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

    r24494 r24712  
    443443
    444444    /**
    445      * Whether to use mysql_real_escape_string
    446      *
    447      * @since 2.8.0
    448      * @access public
    449      * @var bool
    450      */
    451     var $real_escape = false;
    452 
    453     /**
    454445     * Database Username
    455446     *
     
    649640            if ( function_exists( 'mysql_set_charset' ) && $this->has_cap( 'set_charset' ) ) {
    650641                mysql_set_charset( $charset, $dbh );
    651                 $this->real_escape = true;
    652642            } else {
    653643                $query = $this->prepare( 'SET NAMES %s', $charset );
     
    871861
    872862    /**
    873      * Real escape, using mysql_real_escape_string() or addslashes()
     863     * Real escape, using mysql_real_escape_string()
    874864     *
    875865     * @see mysql_real_escape_string()
    876      * @see addslashes()
    877866     * @since 2.8.0
    878867     * @access private
     
    882871     */
    883872    function _real_escape( $string ) {
    884         if ( $this->dbh && $this->real_escape )
    885             return mysql_real_escape_string( $string, $this->dbh );
    886         else
    887             return addslashes( $string );
     873        return mysql_real_escape_string( $string, $this->dbh );
    888874    }
    889875
Note: See TracChangeset for help on using the changeset viewer.