Skip to content
This repository was archived by the owner on Oct 26, 2024. It is now read-only.

Commit 5511229

Browse files
author
Marc Aschmann
committed
Added explicit directory check
1 parent 7eeb8e1 commit 5511229

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Config/AbstractConfig.php

+18-1
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,11 @@ private function extractImports(array $config)
134134
$this->imports = [];
135135
foreach ($config['imports'] as $key => $import) {
136136
if (false === empty($import['resource'])) {
137+
$include = $this->checkPath($import['resource']);
138+
137139
$this->imports = array_replace_recursive(
138140
$this->imports,
139-
$this->readFile($this->currentBasepath . '/' . $import['resource'])
141+
$this->readFile($include)
140142
);
141143
}
142144
}
@@ -170,4 +172,19 @@ private function mergeDefault()
170172
{
171173
$this->default = array_replace_recursive($this->imports, $this->default);
172174
}
175+
176+
/**
177+
* Only add basepath if not already in filename.
178+
*
179+
* @param string $include
180+
* @return string
181+
*/
182+
private function checkPath($include)
183+
{
184+
if (0 !== strpos($include, $this->currentBasepath)) {
185+
$include = $this->currentBasepath . '/' . $include;
186+
}
187+
188+
return $include;
189+
}
173190
}

0 commit comments

Comments
 (0)