From:             carlos at qualinfo dot com dot br
Operating system: Linux MDK9.1 / WindowsXP PRO SP1
PHP version:      4.3.4
PHP Bug Type:     dBase related
Bug description:  Unexpected content of an array generated by the dbase_get_record()

Description:
------------
This bug already was reported (bug # 4244), but was closed due to missing
user feedback.



When I try to print the content of an array - created for the functions
dbase_get_records() or dbase_get_records_by_name(), script returns trash
(each time a different trash).



Notes: 

(1) This problem does not happen with all archives DBF that I try to
list;

(2) The archives (.DBF) are not corrupted;

(3) The garbage that appears includes, also, parts of proper script PHP
(parts of functions, variable, etc.);

(4) In both the tested operational systems (Windows and Linux), the result
is the same;

(5) Another version of the PHP was used (4.3.2), the result was the same;



Linux:

./configure --prefix=/usr/local/php
--with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-dbase



Windows:

Default with php_dbase.dll.



(sorry for bad english)

Reproduce code:
---------------
$dbname1 = "/usr/temp/AAPFUN01.DBF";

$con1 = dbase_open($dbname1,0);



$rows   = dbase_numrecords($con1);

$fields = dbase_numfields($con1);



for ($i=1;$i<=$rows;$i++) {

  $registro = dbase_get_record($con1,$i) or die("erro");



  for ($x=0; $x < $fields; $x++) {

    $teste = $registro[$x];

    echo($teste . "<br>");

  }

}



dbase_close($con1);

Expected result:
----------------
For example, in key #17 of the array, the expected result:



'20020301' (date type field)









Actual result:
--------------
But the actual result is:



'200203011995090101                    1       0.000 0     240.00    
160.0014220219750811        10   020245AL   15  49800238163644712550714425
...(etc.)'



(this result is the rest of the fields (keys) concatenated. the next key
is trash, until the end of array).





-- 
Edit bug report at http://bugs.php.net/?id=27470&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27470&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27470&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27470&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27470&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27470&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27470&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27470&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27470&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27470&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27470&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27470&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27470&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27470&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27470&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27470&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27470&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27470&r=float

Reply via email to