From: cjames@callone.net
Operating system: Win32
PHP version: 4.0.6
PHP Bug Type: dBase related
Bug description: Bad booleans with dbase_get_record_with_names
dbase_get_record_with_names is not returning the correct values when I am
checking a boolean field. Here is the test I used.
function CreateDummy()
{
$fields = array(
array("NAME", "C", 32),
array("MALE", "L"));
$db = dbase_create("dummy.dbf", $fields);
dbase_add_record($db, array("Clinton", "T"));
dbase_add_record($db, array("Debbie", "F"));
dbase_add_record($db, array("Benjamin", "T"));
dbase_add_record($db, array("Anna", "F"));
dbase_close($db);
}
function WorkDummy()
{
CreateDummy();
$db = dbase_open("dummy.dbf", 0);
if ($db == FALSE)
{
echo "<h2>Unable to open the dbase.</h2>";
exit;
}
for ($i = 0; $i < 4; $i++)
{
$dummy = dbase_get_record_with_names($db, $i+1);
echo "$i NAME is ". $dummy['NAME'] ." and MALE is ".
gettype($dummy['MALE']) . " of value ".$dummy['MALE'].
"<br>\n";
}
}
I get the following output.
0 NAME is Clinton and MALE is integer of value 0
1 NAME is Debbie and MALE is integer of value 0
2 NAME is Benjamin and MALE is integer of value 0
3 NAME is Anna and MALE is integer of value 0
--
Edit bug report at: http://bugs.php.net/?id=13865&edit=1