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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: coffy at bluecups dot net
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 07:01:32 2024 UTC