|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26035 Opening existing CDB does not work
Submitted: 2003-10-30 05:30 UTC Modified: 2003-12-15 16:34 UTC
From: a dot stagl at gmx dot at Assigned: helly (profile)
Status: Closed Package: DBM/DBA related
PHP Version: 4CVS, 5CVS OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
48 - 18 = ?
Subscribe to this entry?

 [2003-10-30 05:30 UTC] a dot stagl at gmx dot at
I'm trying to open the contacts-databse from a nokia 9210i mobile, but it doesn't work.

Reproduce code:
$db_conn = dba_open("contacts.cdb","r","cdb");
if (!$db_conn) die ("opening failed");
$key = dba_firstkey ($db_conn);
while ($key != false)
  echo $key."<br />";
  echo dba_fetch ($key, $db_conn)."<br /><br />";
  $key = dba_nextkey ($db_conn);

Expected result:
---------------- get a list of key-value pairs.

Actual result:
The code didn't produce the expected output nor any error message. It seems that the commands dba_firstkey and dba_nextkey always return false instead of a key.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-31 03:55 UTC] a dot stagl at gmx dot at
Unfortunatly, I cannot provide you the DB which I'm refering to, because - as already mentioned - it is the contacts-database from a nokia 9210i which contains sensitive data. I tried to get a sample contacts.cdb directly from nokia, but they haven't been supportive :-(

But I found the following two cdb-databases on the internet: (does not work with the provided code)*checkout*/cdbfile/cdbFile/cdbFile/Attic/test.cdb?rev= (works fine with my code)

 [2003-10-31 08:26 UTC]
It actually returns empty string. When you change the
check to while ($key !== false) it'll crash:

(gdb) bt
#0  0x4072cf51 in kill () from /lib/i686/
#1  0x082762ac in _emalloc (size=1735290733, __zend_filename=0x8327600 "/usr/src/web/php/php4/ext/dba/dba_cdb.c", 
    __zend_lineno=303, __zend_orig_filename=0x84a6220 "/usr/src/web/php/php4/Zend/zend_alloc.c", __zend_orig_lineno=218)
    at /usr/src/web/php/php4/Zend/zend_alloc.c:166
#2  0x082765c1 in _safe_emalloc (nmemb=1735290732, size=1, offset=1, 
    __zend_filename=0x8327600 "/usr/src/web/php/php4/ext/dba/dba_cdb.c", __zend_lineno=303, __zend_orig_filename=0x0, 
    __zend_orig_lineno=0) at /usr/src/web/php/php4/Zend/zend_alloc.c:218
#3  0x080bce64 in dba_nextkey_cdb (info=0x864eb74, newlen=0xbfffd4ec) at /usr/src/web/php/php4/ext/dba/dba_cdb.c:303
#4  0x080bbfa4 in zif_dba_nextkey (ht=1, return_value=0x86401ec, this_ptr=0x0, return_value_used=1)
    at /usr/src/web/php/php4/ext/dba/dba.c:914

Assigned to Marcus who added this thing.

 [2003-10-31 08:28 UTC]
OTOH, I don't think that Nokia/Cascon are using the CDB but something of their own invention.

 [2003-12-15 16:34 UTC]
- The cascon database is not a CDB database.
- The failure is in malloc (safe_emalloc) 
  which tries to allocate more memory then available.
  This cannot be fixed within dba.
- The workaround to check the file length would slowdown
  CDB by adding 2 additional seeks. This contradicts its
- Hence there is nothing to fixed -> closed

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 22 16:01:29 2024 UTC