From: Christopher Jones Date: Thu, 19 Jun 2008 22:39:56 +0000 (+0000) Subject: MFH: X-Git-Tag: php-5.3.0alpha1~707 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2bb7df3504fd7fbbd1fa04dee0a8095fe557cc77;p=php MFH: Fix bug #45266 (Fix build with BDB 4) Fix bug #45267 (Revert invalid assumption about BDB 4 locking; let DBA handle locking) Fix bug #45268 (Fix error callback prototype) --- diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 61b3bc0c41..22ea355939 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -360,7 +360,7 @@ static dba_handler handler[] = { DBA_HND(db3, DBA_LOCK_ALL) /* No lock in lib */ #endif #if DBA_DB4 - DBA_HND(db4, DBA_LOCK_EXT) /* Locking done in library itself */ + DBA_HND(db4, DBA_LOCK_ALL) /* No lock in lib */ #endif #if DBA_INIFILE DBA_HND(inifile, DBA_STREAM_OPEN|DBA_LOCK_ALL|DBA_CAST_AS_FD) /* No lock in lib */ diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c index 69f3967bb5..e0e6ec0424 100644 --- a/ext/dba/dba_db4.c +++ b/ext/dba/dba_db4.c @@ -36,7 +36,11 @@ #include #endif -static void php_dba_db4_errcall_fcn(const char *errpfx, char *msg) +static void php_dba_db4_errcall_fcn( +#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3) + const DB_ENV *dbenv, +#endif + const char *errpfx, const char *msg) { TSRMLS_FETCH(); @@ -81,7 +85,6 @@ DBA_OPEN_FUNC(db4) return FAILURE; /* not possible */ } - gmode |= DB_INIT_LOCK; if (info->flags & DBA_PERSISTENT) { gmode |= DB_THREAD; } @@ -91,10 +94,6 @@ DBA_OPEN_FUNC(db4) filemode = Z_LVAL_PP(info->argv[0]); } -#ifdef DB_FCNTL_LOCKING - gmode |= DB_FCNTL_LOCKING; -#endif - if ((err=db_create(&dbp, NULL, 0)) == 0) { dbp->set_errcall(dbp, php_dba_db4_errcall_fcn); if ( diff --git a/ext/dba/tests/dba_db4.phpt b/ext/dba/tests/dba_db4.phpt index 252797bf41..fcf089a1e9 100644 --- a/ext/dba/tests/dba_db4.phpt +++ b/ext/dba/tests/dba_db4.phpt @@ -9,7 +9,6 @@ DBA DB4 handler test ===DONE=== @@ -18,7 +17,22 @@ database handler: db4 3NYNYY Content String 2 Content 2 replaced -Read during write: allowed +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +--NO-LOCK-- +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed Content 2 replaced 2nd time The 6th value array(3) {