php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41394 dbase_create creates file with corrupted header (correct in 5.2.1)
Submitted: 2007-05-15 08:32 UTC Modified: 2007-05-16 13:17 UTC
From: charley at collins dot ch Assigned:
Status: Closed Package: dBase related
PHP Version: 5.2.2 OS: Gentoo Linux
Private report: No CVE-ID: None
 [2007-05-15 08:32 UTC] charley at collins dot ch
Description:
------------
Create a dbase File with Version 5.2.2 will get currupted dbase header.
Can not be opened from Excel or Borlands Dbase-Engine



Reproduce code:
---------------
// database "definition"
                                        
$def = array(
            array("date",       "D"),
            array("name",        "C",  50),
            array("age",       "N",   3, 0),
            array("email",       "C", 128),
            array("ismember", "L")
        );
                                                                                                            
// creation
$db = dbase_create("/tmp/test.dbf", $def);

if(!$db) print "<strong>Error!</strong>";
dbase_close($db);

Expected result:
----------------
Hexdump of Dbase File with PHP 5.2.1:
00000000  03 6b 05 0f 00 00 00 00  c1 00 bf 00 00 00 00 00                      
                   ^^
                    Day: 15
                ^^
                 Month: 5
             ^^
              Year from 1900: 107 + 1900 = 2007
          ^^
           Dbase-Version: 3 = Dbase Level 5
        

Actual result:
--------------
Hexdump of corrupted Dbase File PHP 5.2.2:
00000000  03 6b 05 da 00 00 00 00  c1 00 bf 00 00 00 00 00
                   ^^
                    Day: 218    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                ^^
                 Month: 5
             ^^
              Year from 1900: 107 + 1900 = 2007
          ^^
           Dbase-Version: 3 = Dbase Level 5



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-16 13:17 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 03:01:29 2024 UTC