Bug #55771 [NEW]: Problem with date fields in a dbase table
| From: | larry at diabloresults dot com | Date: | Fri, 23 Sep 2011 21:57:05 +0000 |
| Subject: | Bug #55771 [NEW]: Problem with date fields in a dbase table | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-163823@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows 7
PHP version: 5.3.8
Package: *Database Functions
Bug Type: Bug
Bug description:Problem with date fields in a dbase table
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] => 05012450472517061Pau
[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:
05012450472517061Pau, ,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 bug report at https://bugs.php.net/bug.php?id=55771&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55771&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55771&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55771&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=55771&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55771&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=55771&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=55771&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=55771&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=55771&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=55771&r=support
Expected behavior: https://bugs.php.net/fix.php?id=55771&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=55771&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=55771&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=55771&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55771&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55771&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=55771&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=55771&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=55771&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=55771&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=55771&r=mysqlcfg