[wp-trac] [WordPress Trac] #10892: msql query fails when running set names utf8

WordPress Trac wp-trac at lists.automattic.com
Sat Oct 3 10:29:12 UTC 2009

#10892: msql query fails when running set names utf8
 Reporter:  digininja     |       Owner:            
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  General       |     Version:  2.8       
 Severity:  normal        |    Keywords:            
 There is code on line 367 of wordpress/wp-includes/wp-db.php which does a
 db query of SET NAMES 'utf8'. The code in query can't handle this
 correctly as it expects it to return a number of rows which it doesn't so
 the line

 while ($i < @mysql_num_fields($this->result)) {

 in the query function fails.

 The easy fix for this is to add

 } elseif ( preg_match("/^\\s*(set) /i",$query) ) {
   return 0;

 as part of the if statement around line 700.

Ticket URL: <http://core.trac.wordpress.org/ticket/10892>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list