php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42261 header wrong for date field
Submitted: 2007-08-09 19:04 UTC Modified: 2007-11-18 14:20 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: roberto at spadim dot com dot br Assigned: iliaa (profile)
Status: Closed Package: dBase related
PHP Version: 5.2.4 OS: any
Private report: No CVE-ID: None
 [2007-08-09 19:04 UTC] roberto at spadim dot com dot br
Description:
------------
sometimes i get 520 size of date field, that's wrong since i can open files on clipper
i changed source to set field length to 8 and precision to 0 when type of field is 'D' and it's work, please checkit

Reproduce code:
---------------
some dbf files have problem

Expected result:
----------------
header information of date always be 8 length

Actual result:
--------------
520 length in some cases
check what i do: dbf_head.c
line ~160

        switch (dbf->db_type) {
            case 'N':
            case 'F':
                dbf->db_flen = dbfield.dbf_flen[0];
                dbf->db_fdc = dbfield.dbf_flen[1];
                break;
=>            case 'D':
=>                dbf->db_flen = 8;
=>                break;
            default:
                dbf->db_flen = get_short(dbfield.dbf_flen);
                break;
        }


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-09 22:57 UTC] spadim at spadim dot com dot br
this could be the same problem of bug #27470
 [2007-08-10 00:30 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2007-09-28 19:18 UTC] roberto at spadim dot com dot br
hello, the same error occur now for logic data (boolean)

    [0] => Array
        (
            [name] => SUSPENSO
            [type] => boolean
            [length] => 34817  <========= should be 1
            [precision] => 0
            [format] => %34817s
            [offset] => 1
        )

    [1] => Array
        (
            [name] => COD_CAD
            [type] => number
            [length] => 9
            [precision] => 0
:
....
 [2007-10-17 06:45 UTC] roberto at spadim dot com dot br
=>            case 'L':
=>                dbf->db_flen = 1;
=>                break;

should work for logic values (boolean)
 [2007-11-14 23:40 UTC] jani@php.net
Ilia, can you fix it in the other place too? (and another, and another? :)
 [2007-11-18 14:20 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC