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  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 43 - 42 = ?

 
 [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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!