|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23188 CDB databases created with "c" mode do not work.
Submitted: 2003-04-13 15:09 UTC Modified: 2003-04-14 16:57 UTC
From: rhondle at hotmail dot com Assigned: helly
Status: Closed Package: DBM/DBA related
PHP Version: 4.3.0 OS: ANY
Private report: No CVE-ID:
 [2003-04-13 15:09 UTC] rhondle at hotmail dot com
The docs indicate that either the 'c' or 'n' modes can be used to create a dba database. When creating a CDB database, the 'n' mode produces a functional database, while the 'c' mode does not. No errors are reported; the database just does not work.

The database created using 'c' doesn't work:
$id = dba_open ("test.db", "c", "cdb_make");
dba_close ($id);

This will create a working database:
$id = dba_open ("test.db", "n", "cdb_make");
if (!$id) exit("dba_open failed\n");
dba_close ($id);

tested with:
$id = dba_open ("test.db", "r", "cdb");
if (!$id) exit("dba_open failed\n");
if (dba_exists("test", $id))
        print dba_fetch("test", $id);
        print "Key not found!!\n";
dba_close ($id);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-13 15:20 UTC]
Check again:
"c" should return NULL in case an error happend and you don not check for that.
 [2003-04-13 15:40 UTC] rhondle at hotmail dot com
dba_open does not return null, implying success. In fact, it *technically* does succeed; it's just that the resulting file is corrupt in some way.

$id = dba_open ("test.db", "c", "cdb_make");
if (!$id) exit("dba_open failed\n");
dba_close ($id);
 [2003-04-14 16:57 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

CDB_MAKE can handle only NEW and READ. Therefore allowing
"C" was an error. Thanks for the mail and time.
 [2003-11-07 06:30 UTC] lx-box at gmx dot de
Creating a db with mode "c" works for me but an existing db is cleared! 

Manual says it is not cleared with "c"...

PHP 4.3.4 on SunOS hermes 5.8
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Dec 01 12:01:36 2015 UTC