|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35366 ibase_fetch_object returns wrong value for empty string in database
Submitted: 2005-11-24 15:45 UTC Modified: 2005-11-28 17:53 UTC
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: sl898 at poczta dot onet dot pl Assigned:
Status: Not a bug Package: InterBase related
PHP Version: 5CVS-2005-11-24 (snap) OS: Windows 2000/2003
Private report: No CVE-ID: None
 [2005-11-24 15:45 UTC] sl898 at poczta dot onet dot pl
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

 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) )

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" } 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-28 15:13 UTC] tm at nanosoft dot com dot pl
I found that after change a php.ini file
magic_quotes_runtime = On
magic_quotes_runtime = Off
everything is ok, and empty fields from database are as expected.
 [2005-11-28 17:53 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Feb 09 08:05:47 2023 UTC