[PHP-DEV] Bug #12972 Updated: is_file & co: no warning on non-existing file From: jeroen <email protected>
Date: 08/29/01

ID: 12972
Updated by: jeroen
Reported By: advgraph <email protected>
Old Summary: is_file() sends errors to error log
Old Status: Closed
Status: Analyzed
Old Bug Type: Filesystem function related
Bug Type: Feature/Change Request
Old Operating System: Redhat 6.2
Operating System: Any
Old PHP Version: 4.0.5
PHP Version: 4
New Comment:

IMHO, it would be more logic to comply to the manual in this case, so that the new is_file($f) behaves like the current:
file_exists($f) && is_file($f)

So nuke the warning on non-existing files. A non-existing file is not a file. Nor a directory, etc etc.

The change is easy, but do people agree that this change should happen?

(-> feature req)

Previous Comments:
------------------------------------------------------------------------

[2001-08-27 11:35:37] mfischer <email protected>

I don't know what your 'last' is, but current CVS doesn't output anything with file_exists():

mfischer <email protected>:~$ php -q
<? error_reporting(E_ALL); $bla = file_exists('sdahfw3gjkgsdgjksd'); var_dump($bla); ?>
bool(false)

No error outpout.

- Markus

------------------------------------------------------------------------

[2001-08-27 10:53:27] chagenbu <email protected>

Actually, the last I checked, you _do_ need to use  <email protected>() if you have error reporting all the way up to avoid error output. That surprised me.

------------------------------------------------------------------------

[2001-08-27 10:48:15] mfischer <email protected>

Wrong. You use file_exists() to first determine if something exists. The name is a bit misleading, you can verify existense of files, directories and links (read: any file type). file_exists() is written to _not_ output any error. Whereas the is_*() functions are for good reason.

So, if you don't want to use file_exists(), you need to use  <email protected>*(). This is the expected behaviour.

- Markus

------------------------------------------------------------------------

[2001-08-27 07:19:34] advgraph <email protected>

when using the is_file function and a file is not found an error is sent back to the error log. I expect this simply to return false in this case. I am aware of file_exists, however in the manual:

 Returns true if the filename exists and is a regular file.

Therefore I expect this to also be testing for file existence. I do not expect debugging output leading me to have to use  <email protected> and possibly miss other crucial error output.

------------------------------------------------------------------------

Edit this bug report at http://bugs.php.net/?id=12972&edit=1

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>