From 5bf33a2e837c69a2b8422ff7dd15b70d1140b089 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 4 Feb 2005 14:29:05 +0000 Subject: [PATCH] - MFH: Fixed bug #31754 (dbase_open() fails for mode = 1). (Mehdi, Derick) --- NEWS | 1 + ext/dbase/dbase.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 26062dd604..e97a70b472 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,7 @@ PHP NEWS - Fixed bug #31796 (readline completion handler does not handle empty return values). (Ilia) - Fixed bug #31755 (Cannot create SOAP header in no namespace). (Dmitry) +- Fixed bug #31754 (dbase_open() fails for mode = 1). (Mehdi, Derick) - Fixed bug #31747 (SOAP Digest Authentication doesn't work with "HTTP/1.1 100 Continue" response). (Dmitry) - Fixed bug #31732 (mb_get_info() causes segfault when no parameters diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c index 5bb109de84..15d9f4f00e 100644 --- a/ext/dbase/dbase.c +++ b/ext/dbase/dbase.c @@ -129,6 +129,11 @@ PHP_FUNCTION(dbase_open) convert_to_string_ex(dbf_name); convert_to_long_ex(options); + if (Z_LVAL_PP(options) == 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot open %s in write-only mode", Z_STRVAL_PP(dbf_name)); + RETURN_FALSE; + } + if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(dbf_name), NULL, CHECKUID_CHECK_FILE_AND_DIR))) { RETURN_FALSE; } -- 2.40.0