php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34184 fails to open dbf file with 255 colums
Submitted: 2005-08-18 11:54 UTC Modified: 2005-08-18 13:21 UTC
From: michel at i-real dot nl Assigned:
Status: Not a bug Package: dBase related
PHP Version: 4.4.0 OS: Linux FC3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: michel at i-real dot nl
New email:
PHP Version: OS:

 

 [2005-08-18 11:54 UTC] michel at i-real dot nl
Description:
------------
When I try to open a .dbf file, the rows that are returned are filled with 0, and somtimes some a row with random crap.

The .dbf file has 255 colums an 10.000 rows . I've tried to open a much smaller file, that's made by the same program, ands that's working out fine.

The .dbf file is 25mb, so if you e-mail me I can give you the URL of it, so that you can use it to test.


Reproduce code:
---------------
<?
$db = dbase_open ("TREND.dbf", "r");

if ($db) {
  // count the number of rows
  $record_numbers = dbase_numrecords($db);
  echo $record_numbers."<br><br><pre>";

  $record_numbers = 250;
  for ($i=0; $i<$record_numbers;$i++) {
        $row = dbase_get_record ($db, $i);
        var_dump($row);
  }

}

// close it
dbase_close($db);

?>

Expected result:
----------------
array(255) {
  ["SECTIME"]=>
  string(9) "808491480"
  ["A"]=>
  string(9) "100.00000"
  ["B"]=>
  string(2) "32"
  ["C"]=>
  string(9) "650.91577"
  ["D"]=>
  string(7) "0.41026"
  ["E"]=>
  string(9) "164.36630"
  ["F"]=>
  string(7) "0.00000"
  ["G"]=>
  string(2) "36"
  ["H"]=>
  string(7) "3.18681"
  ["I"]=>
  string(2) "34"
  ["J"]=>
  string(7) "3.20879"
  ["K"]=>
  string(2) "38"
  ["L"]=>
  string(2) "31"
  ["M"]=>
  string(2) "45"
  ["N"]=>
  string(2) "30"
  ["O"]=>
  string(2) "35"
  ["P"]=>
  string(2) "30"
  ["Q"]=>
  string(8) "69.27961"
  ["R"]=>
  string(7) "1.30000"
  ["S"]=>
  string(7) "1.30000"
  ["T"]=>
  string(9) "112.13675"
  ["U"]=>
  string(7) "0.43956"
  ["V"]=>
  string(7) "0.53724"
  ["W"]=>
  string(8) "99.48718"
  ["X"]=>
  string(8) "70.13431"
  ["Y"]=>
  string(7) "1.30000"
  ["Z"]=>
  string(7) "0.00000"
  ["AA"]=>
  string(9) "116.72771"
  ["AB"]=>
  string(7) "0.19536"
  ["AC"]=>
  string(8) "99.09646"
  ["AD"]=>
  string(7) "0.48840"
  ["AE"]=>
  string(3) "378"
  ["AF"]=>
  string(4) "4898"
  ["AG"]=>
  string(2) "17"
  ["AH"]=>
  string(1) "0"
  ["AI"]=>
  string(7) "1.77045"
  ["AJ"]=>
  string(7) "1.40415"
  ["AK"]=>
  string(7) "0.01099"
  ["AL"]=>
  string(7) "1.22100"
  ["AM"]=>
  string(7) "2.33089"
  ["AN"]=>
  string(8) "19.77534"
  ["AO"]=>
  string(7) "0.00000"
  ["AP"]=>
  string(7) "2.33573"
  ["AQ"]=>
  string(7) "0.00000"
  ["AR"]=>
  string(8) "20.86447"
  ["AS"]=>
  string(7) "1.34115"
  ["AT"]=>
  string(7) "1.73578"
  ["AU"]=>
  string(7) "1.20000"
  ["AV"]=>
  string(7) "1.68498"
  ["AW"]=>
  string(4) "4852"
  ["AX"]=>
  string(4) "3539"
  ["AY"]=>
  string(7) "0.00000"
  ["AZ"]=>
  string(7) "0.00000"
  ["BA"]=>
  string(7) "2.85470"
  ["BB"]=>
  string(7) "3.49060"
  ["BC"]=>
  string(2) "56"
  ["BD"]=>
  string(2) "28"
  ["BE"]=>
  string(2) "41"
  ["BF"]=>
  string(2) "51"
  ["BG"]=>
  string(2) "20"
  ["BH"]=>
  string(7) "0.00000"
  ["BI"]=>
  string(7) "0.00000"
  ["BJ"]=>
  string(7) "0.00000"
  ["BK"]=>
  string(7) "0.00000"
  ["BL"]=>
  string(7) "0.00000"
  ["BM"]=>
  string(7) "1.31575"
  ["BN"]=>
  string(7) "0.67009"
  ["BO"]=>
  string(7) "1.20000"
  ["BP"]=>
  string(7) "2.44933"
  ["BQ"]=>
  string(4) "1139"
  ["BR"]=>
  string(4) "3972"
  ["BS"]=>
  string(8) "20.55189"
  ["BT"]=>
  string(7) "0.00000"
  ["BU"]=>
  string(7) "2.83028"
  ["BV"]=>
  string(7) "3.08718"
  ["BW"]=>
  string(2) "10"
  ["BX"]=>
  string(2) "94"
  ["BYY"]=>
  string(7) "0.00000"
  ["BZ"]=>
  string(2) "20"
  ["CA"]=>
  string(7) "0.00000"
  ["CB"]=>
  string(7) "1.56777"
  ["CC"]=>
  string(7) "1.21123"
  ["CD"]=>
  string(7) "1.40000"
  ["CE"]=>
  string(7) "3.56532"
  ["CF"]=>
  string(4) "2086"
  ["CG"]=>
  string(4) "4000"
  ["CH"]=>
  string(8) "21.51892"
  ["CI"]=>
  string(7) "0.00000"
  ["CJ"]=>
  string(7) "2.85226"
  ["CK"]=>
  string(7) "3.42906"
  ["CL"]=>
  string(2) "16"
  ["CM"]=>
  string(2) "64"
  ["CN"]=>
  string(2) "20"
  ["CO"]=>
  string(8) "63.21856"
  ["CP"]=>
  string(8) "63.60928"
  ["CQ"]=>
  string(8) "65.44566"
  ["CR"]=>
  string(8) "49.23077"
  ["CS"]=>
  string(8) "49.44567"
  ["CT"]=>
  string(8) "48.76191"
  ["CU"]=>
  string(8) "56.49817"
  ["CV"]=>
  string(8) "55.63858"
  ["CW"]=>
  string(8) "59.83883"
  ["CX"]=>
  string(7) "0.00000"
  ["CY"]=>
  string(7) "2.72527"
  ["CZ"]=>
  string(2) "43"
  ["DA"]=>
  string(7) "1.48474"
  ["DB"]=>
  string(2) "42"
  ["DC"]=>
  string(7) "1.71673"
  ["DD"]=>
  string(2) "43"
  ["DE"]=>
  string(7) "2.13919"
  ["DF"]=>
  string(2) "72"
  ["DG"]=>
  string(7) "2.05372"
  ["DH"]=>
  string(7) "0.00000"
  ["DI"]=>
  string(7) "0.00000"
  ["DJ"]=>
  string(3) "242"
  ["DK"]=>
  string(7) "1.69280"
  ["DL"]=>
  string(8) "14.03541"
  ["DM"]=>
  string(7) "0.02051"
  ["DN"]=>
  string(10) "3250.03662"
  ["DO"]=>
  string(10) "1958.24170"
  ["DP"]=>
  string(7) "3.28596"
  ["DQ"]=>
  string(8) "17.01197"
  ["DR"]=>
  string(8) "20.67399"
  ["DS"]=>
  string(7) "0.00611"
  ["DT"]=>
  string(8) "21.39682"
  ["DU"]=>
  string(7) "0.00000"
  ["DV"]=>
  string(9) "-10.98901"
  ["DW"]=>
  string(7) "0.00000"
  ["DX"]=>
  string(7) "0.00000"
  ["DY"]=>
  string(8) "18.36874"
  ["DZ"]=>
  string(2) "46"
  ["EA"]=>
  string(1) "1"
  ["EB"]=>
  string(2) "70"
  ["EC"]=>
  string(2) "67"
  ["ED"]=>
  string(2) "67"
  ["EE"]=>
  string(3) "997"
  ["EF"]=>
  string(3) "102"
  ["EG"]=>
  string(3) "113"
  ["EH"]=>
  string(3) "150"
  ["EI"]=>
  string(3) "583"
  ["EJ"]=>
  string(3) "579"
  ["EK"]=>
  string(3) "585"
  ["EL"]=>
  string(7) "1.60928"
  ["EM"]=>
  string(7) "2.46886"
  ["EN"]=>
  string(8) "13.28449"
  ["EO"]=>
  string(7) "2.51722"
  ["EP"]=>
  string(2) "52"
  ["EQ"]=>
  string(8) "13.49451"
  ["ER"]=>
  string(2) "16"
  ["ES"]=>
  string(7) "2.20366"
  ["ET"]=>
  string(2) "38"
  ["EU"]=>
  string(7) "0.16606"
  ["EV"]=>
  string(2) "14"
  ["EW"]=>
  string(1) "0"
  ["EX"]=>
  string(2) "42"
  ["EY"]=>
  string(2) "85"
  ["EZ"]=>
  string(1) "0"
  ["FA"]=>
  string(4) "1989"
  ["FB"]=>
  string(2) "43"
  ["FC"]=>
  string(1) "2"
  ["FD"]=>
  string(1) "2"
  ["FE"]=>
  string(7) "0.00000"
  ["FF"]=>
  string(7) "0.06886"
  ["FG"]=>
  string(7) "0.03419"
  ["FH"]=>
  string(7) "0.07326"
  ["FI"]=>
  string(7) "0.37607"
  ["FJ"]=>
  string(1) "0"
  ["FK"]=>
  string(7) "0.00000"
  ["FL"]=>
  string(7) "0.07912"
  ["FM"]=>
  string(7) "0.00000"
  ["FN"]=>
  string(7) "0.00000"
  ["FO"]=>
  string(7) "0.44444"
  ["FP"]=>
  string(7) "7.24176"
  ["FQ"]=>
  string(7) "0.00000"
  ["FR"]=>
  string(7) "2.41465"
  ["FS"]=>
  string(7) "7.08791"
  ["FT"]=>
  string(2) "13"
  ["FU"]=>
  string(2) "18"
  ["FV"]=>
  string(2) "16"
  ["FW"]=>
  string(7) "0.00000"
  ["FX"]=>
  string(7) "0.06447"
  ["FY"]=>
  string(7) "0.34188"
  ["FZ"]=>
  string(7) "0.60659"
  ["GA"]=>
  string(7) "0.30525"
  ["GB"]=>
  string(7) "0.26129"
  ["GC"]=>
  string(7) "0.39048"
  ["GD"]=>
  string(7) "0.50476"
  ["GE"]=>
  string(7) "0.51648"
  ["GF"]=>
  string(7) "1.85836"
  ["GG"]=>
  string(7) "1.93407"
  ["GH"]=>
  string(8) "-0.53602"
  ["GI"]=>
  string(7) "0.16850"
  ["GJ"]=>
  string(7) "2.38828"
  ["GK"]=>
  string(2) "21"
  ["GL"]=>
  string(1) "0"
  ["GM"]=>
  string(8) "39.32845"
  ["GN"]=>
  string(8) "38.68132"
  ["GO"]=>
  string(8) "19.43834"
  ["GP"]=>
  string(8) "55.57998"
  ["GQ"]=>
  string(8) "62.51526"
  ["GR"]=>
  string(8) "56.14164"
  ["GS"]=>
  string(8) "23.32112"
  ["GT"]=>
  string(7) "0.00000"
  ["GU"]=>
  string(8) "54.09035"
  ["GV"]=>
  string(7) "1.09646"
  ["GW"]=>
  string(7) "8.48596"
  ["GX"]=>
  string(7) "8.35165"
  ["GY"]=>
  string(7) "0.38462"
  ["HA"]=>
  string(2) "71"
  ["HB"]=>
  string(1) "0"
  ["HC"]=>
  string(1) "1"
  ["HD"]=>
  string(2) "28"
  ["HE"]=>
  string(3) "160"
  ["HF"]=>
  string(1) "0"
  ["HG"]=>
  string(1) "0"
  ["HH"]=>
  string(1) "0"
  ["HI"]=>
  string(1) "1"
  ["HJ"]=>
  string(1) "0"
  ["HK"]=>
  string(1) "3"
  ["HL"]=>
  string(1) "0"
  ["HM"]=>
  string(9) "100.00000"
  ["HN"]=>
  string(1) "0"
  ["HO"]=>
  string(1) "0"
  ["HP"]=>
  string(1) "0"
  ["HQ"]=>
  string(7) "0.22711"
  ["HR"]=>
  string(7) "0.50549"
  ["HS"]=>
  string(7) "0.00000"
  ["HT"]=>
  string(7) "7.07448"
  ["HU"]=>
  string(7) "6.84005"
  ["HV"]=>
  string(7) "6.71306"
  ["HW"]=>
  string(7) "6.37118"
  ["HX"]=>
  string(8) "50.00000"
  ["HY"]=>
  string(9) "-47.02076"
  ["HZ"]=>
  string(8) "-7.16727"
  ["IA"]=>
  string(7) "0.20513"
  ["IB"]=>
  string(8) "35.92674"
  ["IC"]=>
  string(7) "0.23199"
  ["ID"]=>
  string(7) "0.48840"
  ["IE"]=>
  string(7) "0.44689"
  ["IFF"]=>
  string(7) "0.16117"
  ["IG"]=>
  string(7) "0.00977"
  ["IH"]=>
  string(7) "0.12698"
  ["II"]=>
  string(8) "35.54335"
  ["IJ"]=>
  string(8) "34.66423"
  ["IK"]=>
  string(1) "0"
  ["IL"]=>
  string(8) "40.00000"
  ["IM"]=>
  string(7) "0.35165"
  ["INN"]=>
  string(7) "0.00000"
  ["IO"]=>
  string(7) "2.49377"
  ["IP"]=>
  string(7) "1.57753"
  ["IQ"]=>
  string(7) "0.09377"
  ["IR"]=>
  string(7) "0.00000"
  ["ISS"]=>
  string(7) "0.00000"
  ["IT"]=>
  string(7) "0.03907"
  ["IU"]=>
  string(4) "4877"
}


Actual result:
--------------
array(84) {
  [0]=>
  int(808491480)
  [1]=>
  int(0)
  [2]=>
  int(0)
  [3]=>
  int(0)
  [4]=>
  int(0)
  [5]=>
  int(0)
  [6]=>
  int(0)
  [7]=>
  int(0)
  [8]=>
  int(0)
  [9]=>
  int(0)
  [10]=>
  int(727)
  [11]=>
  int(513)
  [12]=>
  int(674)
  [13]=>
  int(0)
  [14]=>
  int(0)
  [15]=>
  int(0)
  [16]=>
  int(0)
  [17]=>
  int(0)
  [18]=>
  int(0)
  [19]=>
  int(0)
  [20]=>
  int(0)
  [21]=>
  int(0)
  [22]=>
  int(0)
  [23]=>
  int(0)
  [24]=>
  int(0)
  [25]=>
  int(0)
  [26]=>
  int(0)
  [27]=>
  int(0)
  [28]=>
  int(0)
  [29]=>
  int(0)
  [30]=>
  int(0)
  [31]=>
  int(0)
  [32]=>
  int(0)
  [33]=>
  int(0)
  [34]=>
  int(0)
  [35]=>
  int(0)
  [36]=>
  int(0)
  [37]=>
  int(0)
  [38]=>
  int(0)
  [39]=>
  int(0)
  [40]=>
  int(0)
  [41]=>
  int(0)
  [42]=>
  int(0)
  [43]=>
  int(0)
  [44]=>
  int(0)
  [45]=>
  int(0)
  [46]=>
  int(0)
  [47]=>
  int(0)
  [48]=>
  int(0)
  [49]=>
  int(0)
  [50]=>
  int(0)
  [51]=>
  int(0)
  [52]=>
  int(0)
  [53]=>
  int(0)
  [54]=>
  int(0)
  [55]=>
  int(0)
  [56]=>
  int(0)
  [57]=>
  int(0)
  [58]=>
  int(0)
  [59]=>
  int(0)
  [60]=>
  int(0)
  [61]=>
  int(0)
  [62]=>
  int(0)
  [63]=>
  int(0)
  [64]=>
  int(1)
  [65]=>
  int(0)
  [66]=>
  int(0)
  [67]=>
  int(0)
  [68]=>
  int(0)
  [69]=>
  int(0)
  [70]=>
  int(0)
  [71]=>
  int(0)
  [72]=>
  int(3907)
  [73]=>
  int(0)
  [74]=>
  int(0)
  [75]=>
  int(0)
  [76]=>
  int(0)
  [77]=>
  int(0)
  [78]=>
  int(0)
  [79]=>
  int(0)
  [80]=>
  int(0)
  [81]=>
  int(0)
  [82]=>
  int(0)
  ["deleted"]=>
  int(0)
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-18 12:51 UTC] sniper@php.net
What fields (and what formats are they in) are there in that dbase file?
 [2005-08-18 12:52 UTC] sniper@php.net
And shouldn't you be using dbase_get_record_with_names() to be able to get your expected result? (associative array)

 [2005-08-18 13:10 UTC] michel at i-real dot nl
The fields, are one N (11) and then 254 F's (lenght 11.5)

The associative array is not needed, the associative part of the expected result is only there because of the way it's created, some code that does 'decode' the dbf entrily in php code (http://server.bo-bo.si/index.php?call=2.1)
 [2005-08-18 13:21 UTC] sniper@php.net
Simple enough: PHP dbase extension does not support 'F' fields.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 15 09:01:26 2024 UTC