[wp-trac] [WordPress Trac] #23085: Calling $wpdb->query() when no connection exists causes mysql_error() to throw an error

WordPress Trac noreply at wordpress.org
Mon Jan 21 00:42:23 UTC 2013


#23085: Calling $wpdb->query() when no connection exists causes mysql_error() to
throw an error
------------------------------------------------+--------------------------
 Reporter:  mbijon                              |       Owner:
     Type:  defect (bug)                        |      Status:  new
 Priority:  normal                              |   Milestone:  Awaiting
Component:  Database                            |  Review
 Severity:  minor                               |     Version:  3.5
 Keywords:  dev-feedback has-patch 2nd-opinion  |  Resolution:
------------------------------------------------+--------------------------
Changes (by mbijon):

 * keywords:  dev-feedback has-patch => dev-feedback has-patch 2nd-opinion


Comment:

 Yes, especially if it's during WP page delivery.

 This is during test though, so there may be something other than a missing
 {{{dbh}}} value. Possibly a late initialization or something to do with
 order of operations. If {{{dbh}}} were really missing, why do the test
 only show it's invalid in this one place?

 Based on how many times $this->dbh and $dbh are set and tested for in the
 {{{wpdb}}} class the order of operations could be a problem for the
 setup/teardown process in the tests. If so, then our test coverage could
 just be missing something else. Should $wpdb be checking for errors in a
 try...catch instead of a conditional block?

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


More information about the wp-trac mailing list