[wp-trac] Re: [WordPress Trac] #2233: wpdb constructor should create a new connection

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 26 23:37:11 GMT 2006


#2233: wpdb constructor should create a new connection
----------------------------+-----------------------------------------------
       Id:  2233            |      Status:  new                     
Component:  Administration  |    Modified:  Wed Apr 26 23:37:11 2006
 Severity:  enhancement     |   Milestone:  2.1                     
 Priority:  normal          |     Version:  2.0                     
    Owner:  anonymous       |    Reporter:  thomasq                 
----------------------------+-----------------------------------------------
Comment (by Libertus):

 masquerade, abhay,

 The original patch from thomasq is correct. wpdb constructor must force a
 new database connection, otherwise imports from different databases on the
 same host with the same username and password as the main WP database will
 fail.

 The problem is not where $this->dbh is used. The problem is that
 $this->dbh on two supposedly independent wpdb objects are references to
 the same underlying database connection object, making wpdb::select()
 change the active database for all of them, including the global $wpdb,
 which side-effect causes the failure.

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


More information about the wp-trac mailing list