php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55771 Problem with date fields in a dbase table
Submitted: 2011-09-23 21:57 UTC Modified: 2011-09-24 19:09 UTC
From: larry at diabloresults dot com Assigned:
Status: Not a bug Package: *Database Functions
PHP Version: 5.3.8 OS: Windows 7
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: larry at diabloresults dot com
New email:
PHP Version: OS:

 

 [2011-09-23 21:57 UTC] larry at diabloresults dot com
Description:
------------
---
From manual page: http://www.php.net/function.dbase-add-record
---
I have created a dbase table with the following schema:

    $schema = array (
        array('ACCOUNTNO','c',20),
        array('COMPANY','c',40),
        array('CONTACT','c',40),
        array('LASTNAME','c',15),
        array('TITLE','c',30),
        array('PHONE1','c',25),
        array('PHONE2','c',25),
        array('PHONE3','c',25),
        array('FAX','c',25),
        array('EXT1','c',6),
        array('EXT2','c',6),
        array('EXT3','c',6),
        array('EXT4','c',6),
        array('ADDRESS1','c',40),
        array('ADDRESS2','c',40),
        array('CITY','c',26),
        array('STATE','c',3),
        array('ZIP','c',10),
        array('KEY5','c',20),
        array('UCRDEAEXP1','D'),
        array('UCREDSSN','c',11),
        array('UCREDFEDID','c',11),
        array('URECACLSEX','D'),
        array('URECATLSEX','D'),
        array('UCRTLEXP1','D'),
        array('UCRTST1','c',2),
        array('URECPALSEX','D')
    );
 I am trying to add the following record:

Array
(
    [0] => 1234FooBar
    [1] => 
    [2] => Paul W. Geiger
    [3] => Geiger
    [4] => Dr.
    [5] => (618)271-7061 Home
    [6] => 
    [7] => (618)795-0629 cell
    [8] =>  
    [9] => Home
    [10] => Cell
    [11] => Work
    [12] => 
    [13] => 2517 N. 38th Street;
    [14] => 
    [15] => Fairmont City
    [16] => IL
    [17] => 62201
    [18] => 
    [19] => 20110930
    [20] => ssn
    [21] => 
    [22] => 20110831
    [23] => 20090630
    [24] => 
    [25] => IL
    [26] => 00000000
)

Using my friendly dbf viewer, I get the following:

1234FooBar, ,Paul W. Geiger  ,Geiger ,Dr.  ,(618)271-7061 Home ,  ,(618)795-0629 cell ,  ,Home ,Cell ,Work , ,2517 N. 38th Street;  ,   ,Fairmont City ,IL ,62201 ,  ,09/30/2011,20110930ssn, , / / , / / , / / , , /20/ 

Note the first date field goes in correctly but the following fields are corrupted.  If I change all the date fields except the last one, the data in inserted 'correctly'.  This is not a viable solution as this dbf table is used to transfer data to a legacy system.

Test script:
---------------
<?php
    $schema = array (
        array('ACCOUNTNO','c',20),
        array('UCRDEAEXP1','D'),
        array('UCRTST1','c',2),
        array('URECPALSEX','D')
    );
    $dbf = dbase_create('TEST.DBF', $schema);
    $data = array('Text Data', '20110911', 'ST', '20111111');
    dbase_add_record($dbf, $data);
    dbase_close($dbf);
?>


Expected result:
----------------
From the dbf viewer:

Text Data,09/11/2011,ST,11/11/2011


Actual result:
--------------
From the dbf viewer:

Text Data,09/11/2011,20,11/ST/1109

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-24 19:09 UTC] aharvey@php.net
-Status: Open +Status: Bogus
 [2011-09-24 19:09 UTC] aharvey@php.net
Thanks for your report. Please note that the dbase extension has been
moved to PECL -- please open a bug on the PECL tracker at
http://pecl.php.net/bugs/report.php?package=dbase
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Aug 10 19:01:25 2020 UTC