From: admin at db-hq dot net
Operating system: Linux - Fedora Core 1
PHP version: 4.3.4
PHP Bug Type: ODBC related
Bug description: DB2 odbc_fetch_row with single row returns invalid result
Description:
------------
I am working on porting phpbb over to DB2, and ran into an error with
odbc_fetch_row. When the following SQL is executed:
�SELECT * FROM phpbb_fourms WHERE forum_id = 1�
odbc_fetch_row($result_id, $i) returns false. Where i = 1.
Sending the query to the database returns one row. When I remove the $i
from odbc_fetch_row it works perfectly. Also if more than one result is
returned there is no problem. Also it seems to only occur when there is a
select * or when there is a large number of columns returning a single
row.
I am pretty sure I have experienced this bug since the early 4.0.* days.
Reproduce code:
---------------
$i = 1;
$k = 0;
while(odbc_fetch_row($result_id, $i) && $k <
$this->result_numrows[$result_id]){
for($j = 1; $j < count($this->result_field_names[$result_id])+1; $j++){
$this->result_rowset[$result_id][$k][$this->result_field_names[$result_id][$j-1]]
= odbc_result($result_id, $j);
}
$i++;
$k++;
}
Expected result:
----------------
Expected odbc_fetch_row($result_id, $i) to return true.
Actual result:
--------------
odbc_fetch_row($result_id, $i) returned false if just one row was selected
from the database. If more than one row was selected it returned true and
worked fine.
Removing the $i from odbc_fetch_row() fixed the problem. None the less it
is still appears a bug. I also verified that the database query does
return one result.
--
Edit bug report at http://bugs.php.net/?id=27557&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27557&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27557&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27557&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27557&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27557&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27557&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27557&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27557&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27557&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27557&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27557&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27557&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27557&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27557&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27557&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27557&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27557&r=float