Skip to content

Commit

Permalink
Fix preg_match() usage when looking for extension type
Browse files Browse the repository at this point in the history
  • Loading branch information
andypost committed Jul 7, 2022
1 parent d675556 commit 9c049f7
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 9c049f7

Please sign in to comment.