Skip to content

Commit 6630c5d

Browse files
author
Wazabii
committed
Minor change
1 parent f93fca7 commit 6630c5d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Url.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,16 @@ public function getRealPath(): string
160160
*/
161161
public function getDirPath(): string
162162
{
163+
163164
if (is_null($this->dirPath)) {
164165
$root = (isset($_SERVER['DOCUMENT_ROOT'])) ? $_SERVER['DOCUMENT_ROOT'] : "";
165166
$root = htmlspecialchars($root, ENT_QUOTES, 'UTF-8');
166167
$this->dirPath = str_replace($root, "", $this->request->getUri()->getDir());
167168

168-
if(is_string($this->dirPath) && $root.$this->dirPath !== $_ENV['APP_DIR']) {
169-
throw new \Exception("Could not validate the dirPath", 1);
169+
if(isset($_ENV['APP_DIR'])) {
170+
if(is_string($this->dirPath) && $root.$this->dirPath !== $_ENV['APP_DIR']) {
171+
throw new \Exception("Could not validate the dirPath", 1);
172+
}
170173
}
171174
}
172175
if (!is_string($this->dirPath)) {

0 commit comments

Comments
 (0)