Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Bug #4168 _connect() missing return statement, performance hit
Submitted: 2005-04-17 03:35 UTC
From: jonathan at sharpmedia dot net Assigned: alan_k
Status: Closed Package: DB_DataObject
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2005-04-17 03:35 UTC] jonathan at sharpmedia dot net
Description: ------------ On line 2030 (CVS 1.349) DataObject tests if $this- >_database_dsn_md5 is set and that the CONNECTIONS index in the array is not empty. Next it checks if the CONNECTIONS value is an error, if so return the error. It tests to set _database if it isn't set... at this point we now know that we have a valid connection, yet execution will continue onward as if there wasn't already a connection! See comment in 'Reproduce code' for where return statement should go. Reproduce code: --------------- ... // is it already connected ? if ($this->_database_dsn_md5 && !empty($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5])) { if (PEAR::isError($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5])) { return $this->raiseError( $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->message, $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->code, PEAR_ERROR_DIE ); } if (!$this->_database) { $this->_database = $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->dsn['database']; } // !!! --> return true; } ... // it's not currently connected! // try and work out what to use for the dsn !

Comments

 [2005-04-20 07:49 UTC] alan_k
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.