]> granicus.if.org Git - php/commitdiff
Emit a warning when open mode modifier t is used wrong.
authorMarcus Boerger <helly@php.net>
Sun, 10 Nov 2002 23:07:35 +0000 (23:07 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 10 Nov 2002 23:07:35 +0000 (23:07 +0000)
ext/dba/dba.c

index 889842faefeb2e0a5a90d419303f63f6a8c2fc44..6384c5c81bd1494f35300a4d489acdfceb966ec7 100644 (file)
@@ -424,7 +424,19 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
        }
        if (*pmode=='t') {
                pmode++;
-               lock_mode |= LOCK_NB; /* test =: non blocking */
+               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);
+                               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);
+                               FREENOW;
+                               RETURN_FALSE;
+                       }
+               } else {
+                       lock_mode |= LOCK_NB; /* test =: non blocking */
+               }
        }
        if (*pmode || !modenr) {
                php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Illegal DBA mode");