Refactoring PhpReader::read() to check for .php file first. Fixed error when there's a directory with the same name.

This commit is contained in:
Majna 2011-10-16 22:21:01 +02:00
parent e47b970811
commit f0d10b4d69

View file

@ -72,10 +72,10 @@ class PhpReader implements ConfigReaderInterface {
} else {
$file = $this->_path . $key;
}
if (!file_exists($file)) {
$file .= '.php';
if (!file_exists($file)) {
throw new ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', substr($file, 0, -4), $file));
$file .= '.php';
if (!is_file($file)) {
if (!is_file(substr($file, 0, -4))) {
throw new ConfigureException(__d('cake_dev', 'Could not load configuration files: %s or %s', $file, substr($file, 0, -4)));
}
}
include $file;