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

Bug #18978 upgrade from alpha2 to beta3 breaks iterator.php
Submitted: 2011-11-10 06:53 UTC Modified: 2011-12-20 04:43 UTC
From: cgmoller Assigned: danielc
Status: Closed Package: MDB2 (version 2.5.0b3)
PHP Version: 5.3.8 OS: Linux 3.0.6-gentoo
Roadmaps: 2.5.0b4    
Subscription  


 [2011-11-10 06:53 UTC] cgmoller (Cameron Moller)
Description: ------------ Fatal error: Call to a member function seek() on a non-object in /usr/share/php/MDB2/Iterator.php on line 86 1. My code works on the previous version PEAR-MDB2-2.5.0_alpha2 PEAR-MDB2_Driver_mssql-1.5.0_alpha2 2. Code fails on the newest version PEAR-MDB2-2.5.0_beta3 PEAR-MDB2_Driver_mssql-1.5.0_beta3 Test script: --------------- $mdb2 = MDB2::factory($dsn); if (PEAR::isError($mdb2)) { die($mdb2->getMessage()); } $mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC); MDB2::loadFile('Iterator'); $query = "SELECT distinct(Asgn_Group) FROM CSC_Report_Active where status != 'resolved' order by Asgn_Group ASC"; $result = $mdb2->query($query, true, true, 'MDB2_BufferedIterator'); foreach ($result as $row) { # script breaks here $tuple = $row['asgn_group']; # <<code for building an HTML table >> } $result->free(); $mdb2->disconnect(); Expected result: ---------------- A table with values as follows: AES_ASC_EMS AES_ASC_L2SEC AES_ASC_MQ AES_ASC_Security with echo var_dump($result); object(MDB2_BufferedIterator)#5 (3) { ["fetchmode":protected]=> int(2) ["result":protected]=> object(MDB2_BufferedResult_mssql)#4 (9) { ["db"]=> object(MDB2_Driver_mssql)#1 (37) { ["string_quoting"]=> array(4) { ["start"]=> string(1) "'" ["end"]=> string(1) "'" ["escape"]=> string(1) "'" ["escape_pattern"]=> bool(false) } ["identifier_quoting"]=> array(3) ... and much more. Actual result: -------------- with echo var_dump($result); object(MDB2_BufferedIterator)#5 (3) { ["fetchmode":protected]=> int(2) ["result":protected]=> resource(9) of type (mssql result) ["row":protected]=> NULL } Fatal error: Call to a member function seek() on a non-object in /usr/share/php/MDB2/Iterator.php on line 86

Comments

 [2011-12-20 00:45 UTC] danielc (Daniel Convissor)
-Status: Open +Status: Closed -Assigned To: +Assigned To: danielc
The bug is triggered by passing a result_wrap_class to a query() method. The problem was in _wrapResult(), which was mistakenly changed in rev 288591 to pass the result resource. A result object is what shoudl be passed. Fixed in r321264. A type check has also been added to the iterator constructor to clarify the problem something like this happens again.
 [2011-12-20 03:38 UTC] danielc (Daniel Convissor)
For the record, revision 288591 (mentioned in my prior comment) addressed Bug #16508.
 [2011-12-20 04:43 UTC] danielc (Daniel Convissor)
Note, this is related to bug #19148.