From: Nicolas dot breuer at belcenter dot be Operating system: Linux PHP version: 5.2.8 PHP Bug Type: dBase related Bug description: Dbase corrupted - columns / date
Description: ------------ Hello, This bug is present in the PHP source code since the release of PHP 5.2.4. We worked with 5.2.3 because we can put a newer release in prod. Today i tried to install the 5.2.8 and same problem so i publish now a bug report. ----- I add one or more record to a DBase file. The header was already on the server Problem is when i opened the file, the columns were truncated. Header of dbf file (empty of course) Array ( [0] => Array ( [name] => NUM [type] => number [length] => 8 [precision] => 0 [format] => %8s [offset] => 1 ) [1] => Array ( [name] => JNL [type] => character [length] => 10 [precision] => 0 [format] => %-10s [offset] => 9 ) [2] => Array ( [name] => NUMBER [type] => number [length] => 10 [precision] => 0 [format] => %10s [offset] => 19 ) [3] => Array ( [name] => DATE [type] => date [length] => 8 [precision] => 0 [format] => %8s [offset] => 29 ) [4] => Array ( [name] => THIRDGROUP [type] => character [length] => 10 [precision] => 0 [format] => %-10s [offset] => 37 ) [5] => Array ( [name] => ARTID [type] => character [length] => 20 [precision] => 0 [format] => %-20s [offset] => 47 ) [6] => Array ( [name] => QTY [type] => number [length] => 10 [precision] => 0 [format] => %10s [offset] => 67 ) [7] => Array ( [name] => UNITPRICE [type] => number [length] => 12 [precision] => 2 [format] => %12s [offset] => 77 ) [8] => Array ( [name] => VATID [type] => character [length] => 10 [precision] => 0 [format] => %-10s [offset] => 89 ) [9] => Array ( [name] => VATPC [type] => character [length] => 10 [precision] => 0 [format] => %-10s [offset] => 99 ) [10] => Array ( [name] => DISCOUNT [type] => character [length] => 5 [precision] => 0 [format] => %-5s [offset] => 109 ) [11] => Array ( [name] => ARTNAME [type] => character [length] => 60 [precision] => 0 [format] => %-60s [offset] => 114 ) [12] => Array ( [name] => D_PMTAUTO [type] => character [length] => 1 [precision] => 0 [format] => %-1s [offset] => 174 ) [13] => Array ( [name] => DATEPAY [type] => date [length] => 8 [precision] => 0 [format] => %8s [offset] => 175 ) [14] => Array ( [name] => YOURREF [type] => character [length] => 10 [precision] => 0 [format] => %-10s [offset] => 183 ) Reproduce code: --------------- $dbname = "temp/test.dbf"; $dbh = dbase_open($dbname, 2) or die("Error! Could not open dbase database file '$dbname'."); $reg=array("1","FAC","20090150","01/01/2009","TEST INPUT","TEST ARTI ID","1","50","0","0","0","Test input char","","-","-"); dbase_add_record($dbh,$reg); $reg=array("1","FAC","20090150","01/01/2009","TEST INPUT","TEST ARTI ID","1","50","0","0","0","Test input char","","-","-"); dbase_add_record($dbh,$reg); Expected result: ---------------- Each value correctly in each column. Actual result: -------------- NUM JNL NUMBER DATE THIRDGROUP ARTID QTY UNITPRICE VATID VATPC DISCOUNT ARTNAME D_PMTAUTO DATEPAY YOURREF 1 FAC 20090150 01/01/20TE ST INPUTTEST ARTI ID 1 500 0 0 Test input char 1 FAC 20090150 01/01/20TE ST INPUTTEST ARTI ID 1 500 0 0 Test input char Date column was empty and the real date (truncated) was put on THIRDGROUP column. Thirdgroup value was put on ArtID column, etc. -- Edit bug report at http://bugs.php.net/?id=47223&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47223&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47223&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47223&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47223&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47223&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47223&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47223&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47223&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47223&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47223&r=support Expected behavior: http://bugs.php.net/fix.php?id=47223&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47223&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47223&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47223&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47223&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47223&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47223&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47223&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47223&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47223&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47223&r=mysqlcfg