ID:               6932
 Comment by:       yarych at ua dot fm
 Reported By:      richard dot heyes at heyes-computing dot net
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Any
 PHP Version:      4.0.2
 New Comment:

This is really needed! Vote for this..


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

[2006-12-05 23:52:05] php at isnoop dot net

Another request for this feature.
file_exists(), is_readable(), is_writable(), and is_file() are begging
for this.

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

[2006-11-08 22:37:50] ralph at smashlabs dot com

Why do you guys refuse to add some kind of functionality to the
language that would allow people to test if a file is in the in the
current include path (any of them) and where the file is located
absolutely?  Seriously?

-ralph

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

[2006-04-05 09:30:41] rhoelvis-bell at yahoo dot com

I just think would be great to check before we get any kind of warning
or whatever. And I also think would be of great importance to offer a
clean code and service.

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

[2006-03-08 16:41:34] ericjhollander at yahoo dot com

This is so obvious.  It should be there.  We should be able to do an
easy test BEFORE calling include().

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

[2006-02-24 22:38:22] arnold at bean-it dot nl

I third that!
And I would also like to see this argument for the function
'is_readable' and 'is_writable'.

Currently there is no clean way to check if a file can be included.
Simply including a file which can't be opened causes a warning to be
triggered. Suppressing include() with an @ is not advisable, since
parse errors won't be displayed, but will cause the script to die,
causing a blank screen. (Happy debugging, hope you're using
ZendStudio).

The best solution I've come up with is:
if (($fp = @fopen($filename, 'r', 1)) and fclose($fp))
include_once($filename);

Anybody reading this bug PLEASE VOTE that this is important to you,
because it doesn't look like anybody is willing to add this (simple)
feature.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/6932

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

Reply via email to