derick          Fri Feb  4 09:29:06 2005 EDT

  Added files:                 (Branch: PHP_5_0)
    /php-src/ext/dbase/tests    bug31754.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/dbase  dbase.c 
  Log:
  - MFH: Fixed bug #31754 (dbase_open() fails for mode = 1). (Mehdi, Derick)
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.233&r2=1.1760.2.234&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1760.2.233 php-src/NEWS:1.1760.2.234
--- php-src/NEWS:1.1760.2.233   Fri Feb  4 08:10:19 2005
+++ php-src/NEWS        Fri Feb  4 09:29:05 2005
@@ -21,6 +21,7 @@
 - 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 
http://cvs.php.net/diff.php/php-src/ext/dbase/dbase.c?r1=1.72&r2=1.72.2.1&ty=u
Index: php-src/ext/dbase/dbase.c
diff -u php-src/ext/dbase/dbase.c:1.72 php-src/ext/dbase/dbase.c:1.72.2.1
--- php-src/ext/dbase/dbase.c:1.72      Thu Jan  8 03:15:07 2004
+++ php-src/ext/dbase/dbase.c   Fri Feb  4 09:29:05 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dbase.c,v 1.72 2004/01/08 08:15:07 andi Exp $ */
+/* $Id: dbase.c,v 1.72.2.1 2005/02/04 14:29:05 derick Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -129,6 +129,11 @@
        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;
        }

http://cvs.php.net/co.php/php-src/ext/dbase/tests/bug31754.phpt?r=1.1&p=1
Index: php-src/ext/dbase/tests/bug31754.phpt
+++ php-src/ext/dbase/tests/bug31754.phpt
--TEST--
Bug #31754: (dbase_open() fails for mode = 1)
--SKIPIF--
<?php
if (!extension_loaded('dbase')) {
        die('skip dbase extension not available');
}
?>
--FILE--
<?php

// database "definition"
$def = array(
        array("foo", "L")
);

// creation
$dbh = dbase_create('/tmp/bug31754.dbf', array(array('foo', 'L')));
dbase_close($dbh);

$dbh = dbase_open('/tmp/bug31754.dbf', 1);
unlink('/tmp/bug31754.dbf');

?>
--EXPECTF--
Warning: dbase_open(): Cannot open /tmp/bug31754.dbf in write-only mode in 
%sbug31754.php on line %d

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to