[Bb-trac] [bbPress] #854: Fix to 3 Warning errors thrown in bbdb->query (/bb-includes/db-mysql.php)

bbPress bb-trac at lists.bbpress.org
Thu Apr 10 03:19:07 GMT 2008


#854: Fix to 3 Warning errors thrown in bbdb->query (/bb-includes/db-mysql.php)
----------------------+-----------------------------------------------------
 Reporter:  richcon   |       Owner:     
     Type:  defect    |      Status:  new
 Priority:  normal    |   Milestone:     
Component:  Back-end  |     Version:  0.9
 Severity:  normal    |    Keywords:     
----------------------+-----------------------------------------------------
 Every time a resource is accessed in bbpress 0.9.0.1 on my server, three
 Warning errors are thrown: "supplied argument is not a valid MySQL result
 resource"; for each page load on my server, this happens four times for a
 total of 12 errors hitting my error logs.

 This happens in bbdb->query after running the query SET NAMES 'utf8',
 which returns 'true' rather than a MySQL result resource.

 I've included a patch that fixes this by including "set" in the list of
 queries that don't involve running mysql_num_fields(), mysql_num_rows(),
 and mysql_free_result(). An alternate fix would be to add type checking
 with is_resource($this->result) before running those functions.

 I believe that this patch might also slightly improve performance by
 preventing needless thrashing of error logs and hitting of error handlers.

-- 
Ticket URL: <http://trac.bbpress.org/ticket/854>
bbPress <http://bbpress.org/>
Innovative forum development


More information about the Bb-trac mailing list