php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35216 segfault using db3
Submitted: 2005-11-14 16:24 UTC Modified: 2005-11-14 20:22 UTC
From: 0602 at eq dot cz Assigned: helly (profile)
Status: Not a bug Package: Reproducible crash
PHP Version: 4.4.1 OS: *
Private report: No CVE-ID: None
 [2005-11-14 16:24 UTC] 0602 at eq dot cz
Description:
------------
Segfault using db3 with php version 4.4.1 (and snapshot php4-STABLE-200511141355) as module for apache (no problems with cli).

Reproduce code:
---------------
<?
        $db = 'data/hereshow.db';
        $id = dba_open($db, 'n', 'db3');
        if(!$id) {
                exit('Could not open database '.$db);
        }

        $key = time();
        if(!dba_insert($key, 'Time in seconds', $id)) {
                dba_close($id);
                exit('Could not update database'.$db);
        }
        else {
                echo 'Successfully updated database with key = '.$key.'<br/>';
        }

        if(($value = dba_fetch($key,$id))) {
                echo 'Found key '.$key.' with value '.$value.'<br/>';
        }
        else {
                echo 'Could not find key '.$key.'<br/>';
        }

        dba_close($id);
?>


Expected result:
----------------
Correct hereshow.db db file in data directory.

Actual result:
--------------
The file hereshow.db is created and is empty (size 0). The process segfaults. The backtrace is the same for 4.4.1 and 200511141355:

(gdb) bt
#0  0x00317a7b in __dbenv_get_errfile () from /lib/libdb-4.2.so
#1  0x00308bf9 in __dbh_am_chk () from /lib/libdb-4.2.so
#2  0x006848b8 in dba_open_db3 () from /usr/local/lib/php/libphp4.so
#3  0x00681f7f in php_dba_find () from /usr/local/lib/php/libphp4.so
#4  0x00682aec in zif_dba_open () from /usr/local/lib/php/libphp4.so
#5  0x00806d87 in execute () from /usr/local/lib/php/libphp4.so
#6  0x007f388f in zend_execute_scripts () from /usr/local/lib/php/libphp4.so
#7  0x007be18f in php_execute_script () from /usr/local/lib/php/libphp4.so
#8  0x0080ccc6 in execute () from /usr/local/lib/php/libphp4.so
#9  0x08068026 in ap_run_handler (r=0x819e170) at config.c:152
#10 0x080685c8 in ap_invoke_handler (r=0x819e170) at config.c:364
#11 0x0806554f in ap_process_request (r=0x819e170) at http_request.c:249
#12 0x08060ec9 in ap_process_http_connection (c=0x8198078) at http_core.c:251
#13 0x08071186 in ap_run_process_connection (c=0x8198078) at connection.c:43
#14 0x080669d8 in child_main (child_num_arg=6833920) at prefork.c:610
#15 0x08066b8e in make_child (s=0x80a0ed0, slot=0) at prefork.c:650
#16 0x08066bff in startup_children (number_to_start=1) at prefork.c:722
#17 0x08067379 in ap_mpm_run (_pconf=0x809f0f0, plog=0x80cb1a0, s=0x1) at prefork.c:941
#18 0x0806cbc8 in main (argc=2, argv=0xbfffdbb4) at main.c:618

# ldd httpd 
[...]
libdb-4.2.so => /lib/libdb-4.2.so (0x00289000)
[...]

# ldd libphp4.so
[...]
libdb-3.3.so => /lib/libdb-3.3.so (0x00761000)
[...]

*NO* problems with the following httpd (different os version (older) - httpd linked against different libdb; same version of apache and php on both oses):
# ldd httpd
[...]
libdb-3.3.so => /lib/libdb-3.3.so (0x00275000)
[...]

PHP was configured with "--with-db3". This libdb versions are installed on affected system: db3-3.3.11, db4-4.2.52.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-14 20:22 UTC] helly@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Both must use the same db version. If you build the berkeley db yourself you can make it generate different function names for your 3.3 version. That way you can have http load db4 and php with db3.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 16:01:28 2024 UTC