php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37589 dbase_open doesnt act like it should
Submitted: 2006-05-25 10:52 UTC Modified: 2006-05-25 13:06 UTC
From: coffy at bluecups dot net Assigned:
Status: Closed Package: dBase related
PHP Version: 5.1.4 OS: Linux
Private report: No CVE-ID: None
 [2006-05-25 10:52 UTC] coffy at bluecups dot net
Description:
------------
When you try to open(mode 0) not correct dbase file using dbase_open it should return just FALSE according to http://www.php.net/manual/en/function.dbase-open.php, instead it prints "unable to get header" and "Warning: dbase_open(): unable to open database".

Reproduce code:
---------------
code 1

<?php
	$db = dbase_open("ERR.DBF", 0);	
	dbase_close($db);
?>

code 2

<?php
	$db = @dbase_open("ERR.DBF", 0);
	@dbase_close($db);
?> 
 

Expected result:
----------------
No warning or "unable to get header", it should just return false (according to currenct documentation). Even if the warning is right behavior(and it's just missing from documentation), it still should be possible to hide "unable to get header" using @.

Actual result:
--------------
Fill "ERR.DBF" with anything else than correct dbase info and you get the "unable to get header" and "Warning ..." (code 1). Also it's not possible to hide "unable to get header" message, code 2 is using @-s and it still prints "unable to get header", when you dont use correct dbf file.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-25 11:48 UTC] tony2001@php.net
I removed the "unable to get headers" error message, but the  PHP Warning must be there, as you should be able to  know the reason why dbase_open() returns FALSE.
 [2006-05-25 13:06 UTC] coffy at bluecups dot net
there is similar bug that i found, you can't also hide (with @) error "open: No such file or directory", if the file you are trying to open with dbase_open() doesn't exist;
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Jun 02 15:01:28 2020 UTC