WordPress.org

Make WordPress Core

Changeset 24758


Ignore:
Timestamp:
07/20/2013 08:16:21 PM (8 years ago)
Author:
nacin
Message:

Check that we have a database connection in wpdb::_real_escape(). see #24773.

File:
1 edited

Legend:

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

    r24724 r24758  
    877877     */
    878878    function _real_escape( $string ) {
    879         return mysql_real_escape_string( $string, $this->dbh );
     879        if ( $this->dbh )
     880            return mysql_real_escape_string( $string, $this->dbh );
     881
     882        $class = get_class( $this );
     883        _doing_it_wrong( $class, "$class must set a database connection for use with escaping.", E_USER_NOTICE );
     884        return addslashes( $string );
    880885    }
    881886
Note: See TracChangeset for help on using the changeset viewer.