[wp-trac] [WordPress Trac] #11819: Use mysql_real_escape_string instead of addslashes

WordPress Trac wp-trac at lists.automattic.com
Sun Jan 17 14:44:38 UTC 2010


#11819: Use mysql_real_escape_string instead of addslashes
--------------------------+-------------------------------------------------
 Reporter:  hakre         |        Owner:  ryan    
     Type:  defect (bug)  |       Status:  reopened
 Priority:  high          |    Milestone:  3.0     
Component:  Security      |      Version:  2.5     
 Severity:  critical      |   Resolution:          
 Keywords:  dev-feedback  |  
--------------------------+-------------------------------------------------

Comment(by Denis-de-Bernardy):

 Well, in this case we merely need to set the necessary variables:

 {{{
 mysql> show variables like 'char%';
 +--------------------------+-----------------------------------------+
 | Variable_name            | Value                                   |
 +--------------------------+-----------------------------------------+
 | character_set_client     | utf8                                    |
 | character_set_connection | utf8                                    |
 | character_set_database   | utf8                                    |
 | character_set_filesystem | binary                                  |
 | character_set_results    | utf8                                    |
 | character_set_server     | utf8                                    |
 | character_set_system     | utf8                                    |
 | character_sets_dir       | /opt/local/share/mysql5/mysql/charsets/ |
 +--------------------------+-----------------------------------------+
 8 rows in set (0.09 sec)

 mysql> set names 'latin1';
 Query OK, 0 rows affected (0.33 sec)

 mysql> show variables like 'char%';
 +--------------------------+-----------------------------------------+
 | Variable_name            | Value                                   |
 +--------------------------+-----------------------------------------+
 | character_set_client     | latin1                                  |
 | character_set_connection | latin1                                  |
 | character_set_database   | utf8                                    |
 | character_set_filesystem | binary                                  |
 | character_set_results    | latin1                                  |
 | character_set_server     | utf8                                    |
 | character_set_system     | utf8                                    |
 | character_sets_dir       | /opt/local/share/mysql5/mysql/charsets/ |
 +--------------------------+-----------------------------------------+
 8 rows in set (0.01 sec)
 }}}

 I take it that character_set_server is the one that we want to override in
 addition?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11819#comment:16>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list