Bug #13865: Bad booleans with dbase_get_record_with_names

From: Date: Mon, 29 Oct 2001 20:40:07 +0000
Subject: Bug #13865: Bad booleans with dbase_get_record_with_names
Groups: php.dev 
Request: Send a blank email to php-dev+get-69290@lists.php.net to get a copy of this message
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



Thread (4 messages)

« previous php.dev (#69290) next »