Edit report at https://bugs.php.net/bug.php?id=55771&edit=1

 ID:                 55771
 Updated by:         ahar...@php.net
 Reported by:        larry at diabloresults dot com
 Summary:            Problem with date fields in a dbase table
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            *Database Functions
 Operating System:   Windows 7
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2011-09-23 21:57:05] 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


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55771&edit=1

Reply via email to