#40288 [NEW]: how to check if a file is includable or not includable
| From: | ironoxid at libero dot it | Date: | Tue, 30 Jan 2007 13:48:10 +0000 |
| Subject: | #40288 [NEW]: how to check if a file is includable or not includable | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-108237@lists.php.net to get a copy of this message | ||
From: ironoxid at libero dot it
Operating system: irrelevant
PHP version: 5.2.0
PHP Bug Type: Feature/Change Request
Bug description: how to check if a file is includable or not includable
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 bug report at http://bugs.php.net/?id=40288&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40288&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40288&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40288&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40288&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=40288&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40288&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40288&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40288&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40288&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40288&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=40288&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=40288&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40288&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40288&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40288&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40288&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40288&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40288&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40288&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40288&r=mysqlcfg