#31754 [Csd->Ver]: dbase_open() fails for mode = 1

From: Date: Fri, 04 Feb 2005 14:44:54 +0000
Subject: #31754 [Csd->Ver]: dbase_open() fails for mode = 1
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73466@lists.php.net to get a copy of this message
ID: 31754 Updated by: derick@php.net Reported By: didou at keliglia dot com -Status: Closed +Status: Verified Bug Type: dBase related Operating System: * PHP Version: 4CVS, 5CVS (2005-02-01) New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2005-02-04 15:40:33] didou@php.net Fixed :) ------------------------------------------------------------------------ [2005-02-03 19:17:33] didou@php.net Here's a patch following Derick's suggestion. It triggers a warning and return false. http://didou.keliglia.com/patches/php-src/dbase/dbase.c.diff.txt (test file included http://didou.keliglia.com/patches/php-src/dbase/tests/) ------------------------------------------------------------------------ [2005-01-29 21:41:21] didou at keliglia dot com Description: ------------ When opening a dbf file using dbase_open($file, 1), the call fails because it can't reads the header infos. We can only open dbase files in read-only or read-write mode. Either it's an implementation or a documentation one. If it's the intended behaviour, can you make it throw a warning more explicit ? Thanks in advance, didou Reproduce code: --------------- <?php error_reporting(E_ALL); $desc = array( array("foo", "C", 50), ); $df = dbase_create("db.dbf", $desc); dbase_close($df); var_dump(dbase_open('db.dbf', 1)); ?> Expected result: ---------------- bool(true) Actual result: -------------- Unable to get header Warning: unable to open database db.dbf in /home/didou/plop.php on line 11 bool(false) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31754&edit=1

« previous php.bugs (#73466) next »