From: sl898 at poczta dot onet dot pl
Operating system: Windows 2000/2003
PHP version: 5CVS-2005-11-24 (snap)
PHP Bug Type: InterBase related
Bug description: ibase_fetch_object returns wrong value for empty string in
database
Description:
------------
Functions ibase_fetch_object, ibase_fetch_row return wrong values when
there is an empty string ('') in firebird table. When there is a 'null'
value in the table this problem doesn't occure.
PHP ver. 5.0.0 works fine, problem is in ver 5.0.4 and higher.
In this example in record number 3 there is value from record number 1
instead of empty string ('').
Reproduce code:
---------------
CREATE TABLE test_table (test_field VARCHAR(10))
Insert 4 records into test_table
rec_no|test_field
------------------
1 | 'test1'
2 | 'test2'
3 | ''
4 | 'test4'
------------------
$sql_string = "SELECT test_field FROM test_table";
$connection = ibase_connect($database, $user, $pass);
$dbo = ibase_query($connection, $sql_string);
while ( $oRow = ibase_fetch_object($dbo) )
{
var_dump($oRow);
}
Expected result:
----------------
{ ["TEST_FIELD"]=> string(5) "test1" }
{ ["TEST_FIELD"]=> string(5) "test2" }
{ ["TEST_FIELD"]=> string(0) "" }
{ ["TEST_FIELD"]=> string(5) "test4" }
Actual result:
--------------
{ ["TEST_FIELD"]=> string(5) "test1" }
{ ["TEST_FIELD"]=> string(5) "test2" }
{ ["TEST_FIELD"]=> string(5) "test1" }
{ ["TEST_FIELD"]=> string(5) "test4" }
--
Edit bug report at http://bugs.php.net/?id=35366&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35366&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=35366&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=35366&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=35366&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35366&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35366&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35366&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35366&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35366&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35366&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=35366&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=35366&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35366&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35366&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35366&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35366&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35366&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35366&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35366&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35366&r=mysqlcfg