Home » Database » DB_DataObject » Bug #3540
Connection caching
Details
| Submitted | 2005-02-21 09:46 UTC |
|---|---|
| From | fela at ds dot pg dot gda dot pl |
| Assigned | alan_k |
| Status | Closed |
| Package | DB_DataObject |
| PHP Version | 5.0.0 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2005-02-21 09:46 UTC] fela at ds dot pg dot gda dot pl
Description:
------------
I've found some bug with caching connection. It appears if you first call free() method of some object and try to call insert() with other object.
Reproduce code:
---------------
$obj = new DB_DataObjects;
$obj->free();
$obj = new DB_DataObjects;
$obj->name = 'Smith';
$obj->insert();
IMO it is bug at the end of free() method because there is creating connection as stdClass object.
// this is a huge bug in DB!
$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->num_rows = array();
and in insert() method this object is using to executing query.
Expected result:
----------------
I think is good to check before this if connection is set:
// this is a huge bug in DB!
if (isset($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5])) {
$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->num_rows = array();
}