ID:               6932
 Comment by:       ericjhollander at yahoo 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:

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


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

[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... :-/

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

[2002-06-04 09:13:56] [EMAIL PROTECTED]

Any objection not to add this?

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

[2001-08-12 16:32:09] [EMAIL PROTECTED]

Maybe I should clarify, it was the filesize and file_exists function I
was hoping would be updated to have an optional argument so they would
check the include_path.

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

[2001-08-12 16:00:53] [EMAIL PROTECTED]

That's nice. Doesn't solve the feature request though.

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

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