From:             charley at collins dot ch
Operating system: Gentoo Linux
PHP version:      5.2.2
PHP Bug Type:     dBase related
Bug description:  dbase_create creates file with corrupted header

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



-- 
Edit bug report at http://bugs.php.net/?id=41394&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41394&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41394&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41394&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41394&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41394&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41394&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41394&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41394&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41394&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41394&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41394&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41394&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41394&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41394&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41394&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41394&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41394&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41394&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41394&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41394&r=mysqlcfg

Reply via email to