|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39653 BDB-4.5 include, older BDB linked
Submitted: 2006-11-28 00:30 UTC Modified: 2006-11-28 11:41 UTC
From: vesely at tana dot it Assigned:
Status: Closed Package: DBM/DBA related
PHP Version: 4.4.4 OS: unix
Private report: No CVE-ID: None
 [2006-11-28 00:30 UTC] vesely at tana dot it
Please add tests for db-4.5 and newer: the compilation does not fail if by chance an older db-4.1 (in my case) existed.
However, when calling dbd->set_errcall the process crashes with pc=0. That happens because the DB structure changed and newer elements have been inserted in the middle of it, rather than at the bottom.

Hopefully, one day BDB will come with an official m4 macro. I already asked them...

One more thing, the errcall has different arguments in 4.5:
--- ./ext/dba/dba_db4.c%    2006-11-27 23:54:31.021697000 +0100
+++ ./ext/dba/dba_db4.c    2006-11-27 23:54:31.031696000 +0100
@@ -35,7 +35,7 @@
#include <db.h>

-static void php_dba_db4_errcall_fcn(const char *errpfx, char *msg)
+static void php_dba_db4_errcall_fcn(const DB_ENV*env, const char *errpfx, const char *msg)

Reproduce code:
This was trapped in the test suite. (Since the program aborted its output was different.)

Expected result:
database handler: db4
Content String 2
Content 2 replaced
Read during write: not allowed
Content 2 replaced 2nd time
The 6th value
array(3) {
 ["key number 6"]=>
 string(13) "The 6th value"
 string(27) "Content 2 replaced 2nd time"
 string(23) "The last content string"

Actual result:
database handler: db4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-28 00:40 UTC]
Elaborate please on how to reproduce it, what is this patch supposed to fix and why.

>Please add tests for db-4.5 and newer: the compilation >does not fail if by chance an older db-4.1 (in my case) existed.
This likely means you're messing different headers and libraries, which is in no way PHP problem.
 [2006-11-28 01:06 UTC] vesely at tana dot it
To reproduce the bug you must install BDB-4.5 (probably 4.4 also fails) over an existing BDB-4.1 (probably 4.3, 4.2, or 4.0 would also reproduce the crash). Then configure

or, say,

I still had libdb-4.1, for programs compiled before I upgraded. However, only the most recent db.h remained installed. After libdb-4.1's db_create, the virtual function bdb->set_errcall appears to be NULL to programs referring to bdb-4.5's included structure definition.

The configure script won't complain, the compilations looks fine, but mentions libdb-4.1. That's because the configure scripts only tests for versions 4.3 and below.

The patch (broken on pasting) only fixes a compiler warning. It's not much relevant until the errcall will not be actually called (presumably after a runtime error). Even then, only the error reporting will be broken, not the functionality.
 [2006-11-28 10:01 UTC]
Please apply this patch: (patch -p0 < bug39653.diff).
After applying it, please run the following commands:
make clean
rm configure
Please check if it works after that.
 [2006-11-28 11:25 UTC] vesely at tana dot it
I bet that patch works, but it's difficult for me to test it.
I've done the following, which works:
--- configure%    2006-11-28 10:53:19.851446000 +0100
+++ configure    2006-11-28 10:53:19.981427000 +0100
@@ -26166,7 +26166,7 @@
    -  for LIB in db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db; do
+  for LIB in db-4.5 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db; do
    if test -f $THIS_PREFIX/lib/lib$LIB.a -o -f $THIS_PREFIX/lib/lib$LIB.$SHLIB_SUFFIX_NAME; then

I guess that's about the same as the patch you produced,
from an end-user perspective - thanx
 [2006-11-28 11:41 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 05:01:30 2024 UTC