php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46536 dbase_create creates file with corrupted header
Submitted: 2008-11-10 13:44 UTC Modified: 2008-11-10 14:24 UTC
From: info at skfree dot sk Assigned:
Status: Not a bug Package: dBase related
PHP Version: 5.2.6 OS: Debian/Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: info at skfree dot sk
New email:
PHP Version: OS:

 

 [2008-11-10 13:44 UTC] info at skfree dot sk
Description:
------------
Create a dbase File with Version 5.2.6 will get currupted dbase header.

Can not be opened from Excel or Borlands Dbase-Engine

similar bug Bug #41394 seems to be not resolved.

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 Dbase File with PHP 5.2.6:

00000000  03 6C 0B 0A 00 00 00 00  c1 00 bf 00 00 00 00 00

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-10 14:22 UTC] jani@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

see bug #45102
 [2008-11-10 14:24 UTC] jani@php.net
And propably bug #46282 too..might all be related to same basic issue..
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 24 00:01:31 2024 UTC