From: Shock dot art at gmail dot com Operating system: FreeBSD 6.3-STABLE PHP version: 5.2.8 PHP Bug Type: dBase related Bug description: Corrupt DBF When Using DATE
Description: ------------ Creating or opening a dBase file with a DATE-field type, will create a database with lenght = 0 for "date" field type. Reproduce code: --------------- Reproduce code: --------------- <?php // database "definition" $def = array( array("date", "D"), array("name", "C", 50), array("email", "C", 128), array("ismember", "L") ); // creation if (!dbase_create('test.dbf', $def)) { echo "Error, can't create the database\n"; } // open in read-write mode $db = dbase_open('test.dbf', 2); if ($db) { for ($i = 0; $i < 5; $i++) { dbase_add_record($db, array( date('Ymd'), 'Name #'. $i, 'Email #'. $i, 'T')); } dbase_close($db); } ?> Expected result: ---------------- A simple database with 5 lines, where DATE, Name & Email are entered correctly. Actual result: -------------- The code above will create file called "test.dbf", which is corrupted when opening it with any normal DBF-viewer (CDBF, DBF Manager, ...). If the DATE-field is replaced with a CHAR-field, all works fine. Date-format is taken from the PHP.NET website and confirmed by the dBase-format. -- Edit bug report at http://bugs.php.net/?id=47113&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47113&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47113&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47113&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47113&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47113&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47113&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47113&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47113&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47113&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47113&r=support Expected behavior: http://bugs.php.net/fix.php?id=47113&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47113&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47113&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47113&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47113&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47113&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47113&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47113&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47113&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47113&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47113&r=mysqlcfg