Ticket #5455: use_mysql_real_escape_string.diff
| File use_mysql_real_escape_string.diff, 1.1 KB (added by filosofo, 4 years ago) |
|---|
-
wp-includes/wp-db.php
81 81 82 82 $this->ready = true; 83 83 84 if ( !empty($this->charset) && version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') ) 84 if ( function_exists('mysql_set_charset') ) { 85 $this->charset = ( empty( $this->charset ) ) ? 'utf8' : $this->charset; 86 mysql_set_charset($this->charset, $this->dbh); 87 } 88 89 elseif ( !empty($this->charset) && version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') ) 85 90 $this->query("SET NAMES '$this->charset'"); 86 91 87 92 $this->select($dbname); … … 138 143 * @return string query safe string 139 144 */ 140 145 function escape($string) { 141 return addslashes( $string ); 142 // Disable rest for now, causing problems 143 /* 144 if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' ) 145 return mysql_escape_string( $string ); 146 else 146 if ( 'utf8' == $this->charset ) 147 147 return mysql_real_escape_string( $string, $this->dbh ); 148 */ 148 else 149 return addslashes( $string ); 149 150 } 150 151 151 152 /**
