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

git-svn-id: https://develop.svn.wordpress.org/trunk@24758 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2013-07-20 20:16:21 +00:00
parent 40153f6e16
commit d0c4c4c334

View File

@@ -876,7 +876,12 @@ class wpdb {
* @return string escaped
*/
function _real_escape( $string ) {
return mysql_real_escape_string( $string, $this->dbh );
if ( $this->dbh )
return mysql_real_escape_string( $string, $this->dbh );
$class = get_class( $this );
_doing_it_wrong( $class, "$class must set a database connection for use with escaping.", E_USER_NOTICE );
return addslashes( $string );
}
/**