|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6852 Misc. bugs
Submitted: 2000-09-22 08:21 UTC Modified: 2001-12-31 07:57 UTC
From: kpeters at otaksoft dot com Assigned: vlad (profile)
Status: Closed Package: dBase related
PHP Version: 4.0.2 OS: FreeBSD 4.0
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: kpeters at otaksoft dot com
New email:
PHP Version: OS:


 [2000-09-22 08:21 UTC] kpeters at otaksoft dot com
Bug 1
dbase.c, line 622 reads:

dbh->db_hlen = sizeof(struct dbf_dhead) + 2 + num_fields * sizeof(struct dbf_dfield);

Should read:

dbh->db_hlen = sizeof(struct dbf_dhead) + 1 + num_fields * sizeof(struct dbf_dfield);

Reason: There is only *one* header record terminator byte (0xD)

Bug 2
dbase.c, line 683 reads:

cur_f->db_flen = 9;

Should read:

cur_f->db_flen = 10;

Reason: Memo refs in Xbase are always of length 10 

Bug 3
dbase.c, line 288:

Code needs to be inserted below here that truncates the dbf file if deleted records have been encountered, i.e. if rec_cnt <> new_cnt.

For this, pack_dbf would need to return a 'trunc_required'
flag. Code could also sit in dbf_rec.c function pack_dbf


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-24 16:34 UTC]
Please do not report multiple bugs in one report, also please use the short desc in the future, it is there for a reason, so that people can see immediately what the bug is about. before posting another bug report please read

Thanks anyway

 [2001-12-31 05:34 UTC]
Bug #1 is valid, though I know of applications that add add a null byte there, just like php does. This seems to be relatively harmless, because most of the apps are smart wnough to recognize that change, yet it is not in the specs, so it got fixed. Scream if it breaks anything.

Bug #2 is valid, yet as of now there is really no support for .dbt files anyway, so the only difference that would make is during creation of a new dbf file. Fixed.

Bug #3 - I'm not sure to which revision of the file kpeters refers to, definitely not line 288 anymore:( I need to look into what he meant. Will do so tomorrow.

Assigning to self for now...
 [2001-12-31 07:57 UTC]
... and bug 3... you were using revision 1.30 for your line numbers :). From looking at it... I am not sure what you are saying here. Do you imply that we have to pack() the file before adding a new record? I do not think so.

If you were talking about dbase_pack() not truncating the file, I fixed it in dbf_rec.c

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 03:01:27 2024 UTC