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

Bug #3847 DB DataSource emits a notice if no records returned
Submitted: 2005-03-16 17:26 UTC
From: justinpatrin Assigned: asnagy
Status: Closed Package: Structures_DataGrid
PHP Version: 4.3.10 OS: Linux (Gentoo)
Roadmaps: (Not assigned)    
Subscription  


 [2005-03-16 17:26 UTC] justinpatrin
Description: ------------ When binding a DB resultset to DG, if there are no returned records a notice is emitted about $recordSet[0]. (I'm paraphrasing as I don't have the notic ein front of me at the moment.) To fix this, there should be an extra clause in: if (!$this->_options['fields']) { namely: if (!$this->_options['fields'] && $recordSet) { or if (!$this->_options['fields'] && count($recordSet)) { Reproduce code: --------------- $sth = $db->query('SELECT * FROM table WHERE 1=0'); $dg =& new Structures_DataGrid(); $dg->bind($sth); $dg->renderer->render(); Expected result: ---------------- Only the headers are displayed. Actual result: -------------- Headers are displayed with a notice about a key in $resultSet not set.

Comments

 [2005-03-16 18:15 UTC] justinpatrin
It's a notice *and* a warning: Notice: Undefined offset: 0 in .../Structures/DataGrid/DataSource/DB.php on line 100 Warning: array_keys(): The first argument should be an array in .../Structures/DataGrid/DataSource/DB.php on line 100
 [2005-03-18 21:18 UTC] asnagy
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.