Skip to content

Commit 2e24641

Browse files
authored
fix(view): regex timeout (#1015)
1 parent e1ce286 commit 2e24641

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Tempest/View/src/ViewComponentDiscovery.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ public function discoverPath(DiscoveryLocation $location, string $path): void
4848

4949
$contents = str(file_get_contents($path))->ltrim();
5050

51-
$matches = $contents->match('/(?<header>(.|\n)*?)<x-component\s+name="(?<name>[\w\-]+)">(?<view>(.|\n)*?)<\/x-component>/');
51+
preg_match(
52+
pattern: '/(?<header>(.|\n)*?)<x-component name="(?<name>[\w\-]+)">(?<view>(.|\n)*?)<\/x-component>/',
53+
subject: $contents->toString(),
54+
matches: $matches,
55+
);
5256

5357
if ($fileName->startsWith('x-')) {
5458
$this->discoveryItems->add($location, [

0 commit comments

Comments
 (0)