From 3f92301039e58506ced258b4c2fd8920aa18cf07 Mon Sep 17 00:00:00 2001 From: cyrrill Date: Fri, 5 Dec 2014 16:01:46 +0100 Subject: [PATCH] Adds fallback for path init --- classes/Core/Path.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/classes/Core/Path.php b/classes/Core/Path.php index 259252c..02dddc3 100644 --- a/classes/Core/Path.php +++ b/classes/Core/Path.php @@ -14,7 +14,15 @@ class Path */ public function __construct($path = null) { - $this->path = ($path) ?: dirname($_SERVER['DOCUMENT_ROOT']."/../../"); + if ($path !== null) { + $this->path = $path; + } else{ + if ($_SERVER['DOCUMENT_ROOT']) { + $this->path = dirname($_SERVER['DOCUMENT_ROOT']."/../../"); + } else { + $this->path = realpath(__DIR__."/../../../../.."); + } + } } public function __toString()