Skip to content

Commit

Permalink
ISSUE-1426: Replaced regex config path matching by strpos
Browse files Browse the repository at this point in the history
  • Loading branch information
BeMySlaveDarlin committed Mar 14, 2021
1 parent e65d38c commit c4d1858
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

## Fixed
- Fixed model creation failure in webtools due to wrong variable mutation [#1415](https://github.com/phalcon/phalcon-devtools/issues/1415)
- Fixed config path detection to platform independent [#1426](https://github.com/phalcon/phalcon-devtools/issues/1426)

## Changed

Expand Down
9 changes: 4 additions & 5 deletions src/Builder/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,16 @@ public function getConfig($type = null): Config
$directory = new RecursiveDirectoryIterator('.');
$iterator = new RecursiveIteratorIterator($directory);
foreach ($iterator as $f) {
if (preg_match('/\/config\.php$/i', $f->getPathName())) {
if (false !== strpos($f->getPathName(), 'config.php')) {
$config = include $f->getPathName();
if (is_array($config)) {
$config = new Config($config);
}

return $config;
} else {
if (preg_match('/config\.ini$/i', $f->getPathName())) {
return new ConfigIni($f->getPathName());
}
}
if (false !== strpos($f->getPathName(), 'config.ini')) {
return new ConfigIni($f->getPathName());
}
}

Expand Down

0 comments on commit c4d1858

Please sign in to comment.