From: php at johnlevine dot com
Operating system: BSD/OS 4.3.1
PHP version: 4.3.2
PHP Bug Type: Reproducible crash
Bug description: dba_ routines with ndbm crash
Description:
------------
This program prints Resource handle #5, and then crashes.
It works OK in 4.2.2, crashes in a version of 4.3.0 I had
lying around. It crashes in the Apache module, which is
where I first noticed it.
There also seems to be a change since 4.2 that it used to append .db to
the file name but doesn't any more.
It's compiled --with-mysql --with-apxs --with-ndbm
(I know that ndbm is old and tired, but it's distributed
with BSD/OS and I have a lot of existing ndbm files that
I'm using.)
Reproduce code:
---------------
$a = dba_popen("test.db", "r", "ndbm");
print "handle is $a\n"; // prints Resource #5
$k = dba_firstkey($a);
print "key is $k\n"; // segfaults, see trace below
Expected result:
----------------
should print first key in db file
Actual result:
--------------
Segmentation violation:
#0 0x481b5f1d in dbm_firstkey () from /shlib/libc.so.2
#1 0x806486f in dba_firstkey_ndbm (info=0x81bdf00, newlen=0x8046070)
at /home/src/php-4.3.2/ext/dba/dba_ndbm.c:126
#2 0x8063a74 in zif_dba_firstkey (ht=1, return_value=0x81bc68c,
this_ptr=0x0,
return_value_used=1) at /home/src/php-4.3.2/ext/dba/dba.c:704
#3 0x8139bf3 in execute (op_array=0x81bb88c)
at /home/src/php-4.3.2/Zend/zend_execute.c:1608
#4 0x812821e in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /home/src/php-4.3.2/Zend/zend.c:869
#5 0x8100275 in php_execute_script (primary_file=0x8047a94)
at /home/src/php-4.3.2/main/main.c:1671
#6 0x814188e in main (argc=2, argv=0x8047afc)
at /home/src/php-4.3.2/sapi/cli/php_cli.c:806
#7 0x8061843 in __start ()
--
Edit bug report at http://bugs.php.net/?id=24824&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24824&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24824&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=24824&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24824&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24824&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24824&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24824&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24824&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24824&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24824&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24824&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24824&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24824&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24824&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24824&r=gnused