ZF-8354: Dispatcher : include_once statement can generate a Warning if the file does not exists
Description
The following (around line 337) from Zend_Controller_Dispatcher_Standard should be refactored:
$dispatchDir = $this->getDispatchDirectory();
$loadFile = $dispatchDir . DIRECTORY_SEPARATOR . $this->classToFilename($className);
if (!include_once $loadFile) {
require_once 'Zend/Controller/Dispatcher/Exception.php';
throw new Zend_Controller_Dispatcher_Exception('Cannot load controller class "' . $className . '" from file "' . $loadFile . "'");
}
include_once statement can generate a Warning if the file does not exists It should be @include_once or check with file_exists
Comments
Posted by Raphael Dehousse (thymus) on 2009-11-20T06:10:16.000+0000
I'm not able to reopen the issue ZF-4736
So, I clone it to say :
Hello,
This issue should be reopened because the include_once statement can generate a Warning if the file does not exists. It should be @include_once or check with file_exists
Thanks to fix this
Cheers,
Raphaƫl Dehousse
Posted by Marco Kaiser (bate) on 2009-11-20T06:59:27.000+0000
fixed with r19092
Posted by Matthew Weier O'Phinney (matthew) on 2009-11-25T06:34:16.000+0000
Marco -- please modify this to use Zend_Loader::isReadable() in place of file_exists. file_exists() does not take into account the include_path, and as such could generate a false negative.
Posted by Marco Kaiser (bate) on 2009-11-25T06:40:34.000+0000
fixed with r19235