Skip to content

Commit

Permalink
Merge pull request #442 from skilld-labs/441-type
Browse files Browse the repository at this point in the history
Fix preg_match() usage when looking for extension type
  • Loading branch information
mglaman authored Jul 7, 2022
2 parents d675556 + 9c049f7 commit 8acaa1e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Drupal/ExtensionDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,11 @@ protected function scanDirectory($dir): array
$type = false;
$file = $fileinfo->openFile('r');
while (!$type && !$file->eof()) {
preg_match('@^type:\s*(\'|")?(\w+)\1?\s*$@', $file->fgets(), $matches);
if (isset($matches[2])) {
$type = $matches[2];
if ($line = $file->fgets()) {
preg_match('@^type:\s*(\'|")?(\w+)\1?\s*$@', $line, $matches);
if (isset($matches[2])) {
$type = $matches[2];
}
}
}
if ($type === false) {
Expand Down

0 comments on commit 8acaa1e

Please sign in to comment.