Req #40288 [Opn->Csd]: how to check if a file is includable or not includable
| From: | cweiske@php.net | Date: | Tue, 14 Aug 2012 11:57:32 +0000 |
| Subject: | Req #40288 [Opn->Csd]: how to check if a file is includable or not includable | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172593@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=40288&edit=1
ID: 40288
Updated by: cweiske@php.net
Reported by: ironoxid at libero dot it
Summary: how to check if a file is includable or not
includable
-Status: Open
+Status: Closed
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: irrelevant
PHP Version: 5.2.0
-Assigned To:
+Assigned To: cweiske
Block user comment: N
Private report: N
New Comment:
stream_resolve_include_path() does what you want (from PHP 5.3.2 on).
Previous Comments:
------------------------------------------------------------------------
[2007-01-30 13:48:10] ironoxid at libero dot it
Description:
------------
Actually there is a difference between read and include authorization: I can't read a file,
but, at the same time, I can include it (read about safe_mode_include_dir).
Unfortunately there is no way to check if I can include a file or not.
Actually the only way to do this is perform an include, and this is not always what we want to do.
Reproduce code:
---------------
function check_plugins($pluginsFromConfig) {
foreach($pluginsFromConfig As $filepath) {
if(is_includable($filepath)===false) {
trigger_error('plugin not found',E_USER_ERROR);
exit;
}
else echo 'plugin -bla- -bla- exists';
}
}
Expected result:
----------------
We expect to know if a file can be included, without include it.
Actual result:
--------------
Function is_includable doesn't exist. We tried to use file_exists, etc. but are limited by
safe_mode restrictions.
Documentation say that we can use is_readable for ignore safe_mode restriction but it doesn't
work and if it will work it will be logically wrong.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=40288&edit=1