ID: 6932
Comment by: ralph at smashlabs dot com
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:
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
Previous Comments:
------------------------------------------------------------------------
[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-10 02:34:09] admin at microsoft dot com
FIX THIS ASAP PLZ !!!
IS IMPORTANT !!!
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[2005-06-30 19:15:44] sr at brightlight dot ch
I second this request.
Open since 5 years, since PHP5's autoload even more important
and not even yet assigned... :-/
------------------------------------------------------------------------
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