helly Mon Dec 9 13:07:23 2002 EDT
Modified files: (Branch: PHP_4_3)
/php4/ext/dba dba.c
Log:
MFH: '-' modifier (bug #20282, #20858)
Index: php4/ext/dba/dba.c
diff -u php4/ext/dba/dba.c:1.61.2.3 php4/ext/dba/dba.c:1.61.2.4
--- php4/ext/dba/dba.c:1.61.2.3 Fri Nov 22 10:53:00 2002
+++ php4/ext/dba/dba.c Mon Dec 9 13:07:23 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba.c,v 1.61.2.3 2002/11/22 15:53:00 helly Exp $ */
+/* $Id: dba.c,v 1.61.2.4 2002/12/09 18:07:23 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -422,14 +422,22 @@
*/
strlcpy(mode, Z_STRVAL_PP(args[1]), sizeof(mode));
pmode = &mode[0];
- if (pmode[0] && (pmode[1]=='d' || pmode[1]=='l')) { /* force lock on db file
or lck file */
- if (pmode[1]=='d') {
+ if (pmode[0] && (pmode[1]=='d' || pmode[1]=='l' || pmode[1]=='-')) { /* force
+lock on db file or lck file or disable locking */
+ switch (pmode[1]) {
+ case 'd':
if ((hptr->flags & DBA_LOCK_ALL) == 0) {
php_error_docref2(NULL TSRMLS_CC,
Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_NOTICE, "Handler %s does locking
internally", hptr->name);
}
lock_dbf = 1;
+ /* no break */
+ case 'l':
+ lock_flag = DBA_LOCK_ALL;
+ break;
+ default:
+ case '-':
+ lock_flag = 0;
+ break;
}
- lock_flag = DBA_LOCK_ALL;
} else {
lock_flag = (hptr->flags&DBA_LOCK_ALL);
}
@@ -459,18 +467,23 @@
lock_mode = 0;
file_mode = "";
}
- if (*pmode=='d' || *pmode=='l') {
+ if (*pmode=='d' || *pmode=='l' || *pmode=='-') {
pmode++; /* done already - skip here */
}
if (*pmode=='t') {
pmode++;
+ if (!lock_flag) {
+ php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]),
+Z_STRVAL_PP(args[1]), E_WARNING, "You cannot combine modifiers - (no lock) and t
+(test lock)", hptr->name);
+ FREENOW;
+ RETURN_FALSE;
+ }
if (!lock_mode) {
if ((hptr->flags & DBA_LOCK_ALL) == 0) {
- php_error_docref2(NULL TSRMLS_CC,
Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Handler %s uses its own
locking which doesn't support mode modifier t (testing)", hptr->name);
+ php_error_docref2(NULL TSRMLS_CC,
+Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Handler %s uses its own
+locking which doesn't support mode modifier t (test lock)", hptr->name);
FREENOW;
RETURN_FALSE;
} else {
- php_error_docref2(NULL TSRMLS_CC,
Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Handler %s doesn't uses
locking for this mode which makes modifier t (testing) obsolete", hptr->name);
+ php_error_docref2(NULL TSRMLS_CC,
+Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Handler %s doesn't uses
+locking for this mode which makes modifier t (test lock) obsolete", hptr->name);
FREENOW;
RETURN_FALSE;
}
@@ -784,3 +797,4 @@
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
+
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php