|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41913 dbase functions return not all records from a dbf file
Submitted: 2007-07-06 08:21 UTC Modified: 2007-07-06 16:02 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: sdmaster at mail dot ru Assigned:
Status: Not a bug Package: dBase related
PHP Version: 5.2.3 OS: Windows XP SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: sdmaster at mail dot ru
New email:
PHP Version: OS:


 [2007-07-06 08:21 UTC] sdmaster at mail dot ru
I'm using Apache 2.2.4, php 5.2.3 loaded with LoadModule. php_dbase extension v5.2.3.3. Apache is run from a local administrator's account.

after I open a dbf file and use dbase_numrecords() to retrieve number of records in the file, it returns a number that is randomly less than actual by 1, 2 or 3. accordingly, dbase_get_record_with_names() doesn't want to get, i.e., 23-th record from a 24-records dbf file.

a sample dbf file is created by Delphi 7 TDbf component v6.9 and contains russian characters in string fields.

at the same time such tools as DBV Viewer or like show everything correctly.

reference to the sample dbf file lies inside comments in the posted php code.

Reproduce code:


 a simple php code, purely from examples

 test file is generated by TDbf Delphi 7 component

 a sample dbf file, which is reported by php dbase functions to
 have 1 records less than actual, could be taken from here:


if ($db = dbase_open('c:\temp\test.dbf', 0)) {

  $rn = dbase_numrecords($db);

  for ($i = 1; $i<=$rn; $i++) {
      $row=dbase_get_record_with_names($db, $i);




Expected result:
all records from dbf file

Actual result:
all records except the last one


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-06 09:17 UTC]
Both PHP and dbview output 5 (five) records.
 [2007-07-06 13:05 UTC] sdmaster at mail dot ru
note that the sample dbf has in fact 6 (six) records!
I use dbf viewer 2000
 [2007-07-06 13:43 UTC]
Well, then there is apparently some problem with the DBF file since not only PHP, but the dbview tool does not show this 6th record.
 [2007-07-06 15:55 UTC] sdmaster at mail dot ru
so the question remains.. will this be considered a bug of the php_dbase extension and eventually fixed, or the result of dbview will keep being a standard that php_dbase will stick to?
 [2007-07-06 16:02 UTC]
I do not consider a bug something that doesn't work witn a third party utility which is considered de-facto standard for viewing DBF files, that's why the report is marked as "bogus".
But feel free to send us a patch (to support b0rked DBFs), we would gladly accept it if it doesn't break anything else.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Jun 07 19:03:43 2023 UTC