]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/BasePath.php
Merge pull request #7248 from nupplaphil/bugs/6916-fatal-network
[friendica.git] / src / Util / BasePath.php
index fc9c3b5939b1706fa24b6ce032fb4d33f3637fb7..f29c2e864ec414b7d1219344e4e14d6fd0b622f9 100644 (file)
@@ -19,15 +19,21 @@ class BasePath
         */
        public static function create($basePath, array $server = [])
        {
-               if (!$basePath && !empty($server['DOCUMENT_ROOT'])) {
+               if ((!$basePath || !is_dir($basePath)) && !empty($server['DOCUMENT_ROOT'])) {
                        $basePath = $server['DOCUMENT_ROOT'];
                }
 
-               if (!$basePath && !empty($server['PWD'])) {
+               if ((!$basePath || !is_dir($basePath)) && !empty($server['PWD'])) {
                        $basePath = $server['PWD'];
                }
 
-               return self::getRealPath($basePath);
+               $basePath = self::getRealPath($basePath);
+
+               if (!is_dir($basePath)) {
+                       throw new \Exception(sprintf('\'%s\' is not a valid basepath', $basePath));
+               }
+
+               return $basePath;
        }
 
        /**