PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #3264

joinAdd() generates PHP notice: Undefined property: _query

Details

Submitted2005-01-21 23:32 UTC
Fromkoto1sa at o2 dot pl
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP VersionIrrelevant
OSirrelevant
Roadmaps(Not assigned)

Comments

[2005-01-21 23:32 UTC] koto1sa at o2 dot pl

Description:
------------
joinAdd() generates PHP notice:
Notice: Undefined property: _query in d:\www\pear\PEAR\DB\DataObject.php on line 2846

It seems that this behaviour happens when the class being joined has its $_query variable unset() when previously calling fetch() method (unless config value 'keep_query_after_fetch' is specified).

joinAdd() explicitely calls (non-existing ater fetch()) $_query['condition'] value, thus genereating PHP notice.

Suggested correction: isset() in line 2846.

Reproduce code:
---------------
$news = new DataObject_News();
$galleries = new DataObject_Galleries();

$galleries->find();
while ($galleries->fetch()) {
// now we silently unset() $galleries->_query
// do stuff ...anything
}

$news->joinAdd($galleries); // and now we try to access it
$news->find();
while ($news->fetch())
// anything

Expected result:
----------------
no warnings, just the data processed.

Actual result:
--------------
Notice: Undefined property: _query in d:\www\pear\PEAR\DB\DataObject.php on line 2846

[2005-01-21 23:36 UTC] koto1sa at o2 dot pl

-