ID: 26035
Updated by: [EMAIL PROTECTED]
Reported By: a dot stagl at gmx dot at
-Status: Assigned
+Status: Closed
Bug Type: DBM/DBA related
Operating System: *
PHP Version: 4CVS, 5CVS
Assigned To: helly
New Comment:
- 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
design.
- Hence there is nothing to fixed -> closed
Previous Comments:
------------------------------------------------------------------------
[2003-10-31 08:28:12] [EMAIL PROTECTED]
OTOH, I don't think that Nokia/Cascon are using the CDB but something
of their own invention.
------------------------------------------------------------------------
[2003-10-31 08:26:33] [EMAIL PROTECTED]
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/libc.so.6
#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 03:55:39] 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:
http://web.mit.edu/cascon/updates/cascon.cdb (does not work with the
provided code)
http://cvs.sourceforge.net/viewcvs.py/*checkout*/cdbfile/cdbFile/cdbFile/Attic/test.cdb?rev=1.1.1.1
(works fine with my code)
HTH
------------------------------------------------------------------------
[2003-10-30 05:30:43] a dot stagl at gmx dot at
Description:
------------
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);
}
dba_close($db_conn);
Expected result:
----------------
...to 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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26035&edit=1