Browse Source

Merge pull request #8533 from cakephp/phar-file-config

Completing fix in FileConfigTrait to make phar files work
Mark Story 10 years ago
parent
commit
9290327c8e
1 changed files with 7 additions and 3 deletions
  1. 7 3
      src/Core/Configure/FileConfigTrait.php

+ 7 - 3
src/Core/Configure/FileConfigTrait.php

@@ -56,10 +56,14 @@ trait FileConfigTrait
 
         $file .= $this->_extension;
 
-        if ($checkExists && !is_file($file) && !is_file(realpath($file))) {
-            throw new Exception(sprintf('Could not load configuration file: %s', $file));
+        if (!$checkExists || is_file($file)) {
+            return $file;
         }
 
-        return $file;
+        if (is_file(realpath($file))) {
+            return realpath($file);
+        }
+
+        throw new Exception(sprintf('Could not load configuration file: %s', $file));
     }
 }