ID: 47113 User updated by: Shock dot art at gmail dot com Reported By: Shock dot art at gmail dot com Status: Open Bug Type: dBase related Operating System: FreeBSD 6.3-STABLE PHP Version: 5.2.8 New Comment:
Creating a dBase file with a DATE-field type, will corrupt the database. Previous Comments: ------------------------------------------------------------------------ [2009-01-15 10:43:36] Shock dot art at gmail dot com 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 this bug report at http://bugs.php.net/?id=47113&edit=1