Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 1.5.0
-
Fix Version/s: 1.5.2
-
Component/s: Zend_Loader
-
Labels:None
Description
The method Zend_Loader::isReadable() uses fopen to check if a file exists and the @-operator to abort its error-messages:
public static function isReadable($filename)
{
if (!$fh = @fopen($filename, 'r', true)) {
return false;
}
return true;
}
This only aborts the messages from beeing displayed, the error-handler will be triggert anyway. So if you use your own error-handler, everytime a file is beeing checked with this function and not found (and this may happen very often) a php-notice is thrown and beeing logged into your logfile for example or your database.
Why not use the 'file_exists()' function of php?
// example with include path:
static $paths = null;
if ($paths == null) {
$paths = explode(PATH_SEPARATOR, get_include_path());
}
foreach ($paths as $path) {
$fullpath = $path.DIRECTORY_SEPARATOR.$filename;
if (file_exists($fullpath)) {
return true;
}
}
return file_exists($filename);
Issue Links
| This issue depends on: | ||||
| ZF-2985 | Bug in Zend_Loader::isReadable if file does not exist |
|
|
|
I think it's cause file_exits() doesn't follow the include path where as the third parameter of fopen() is weather is should use the include path or not.