Skip to content

Commit 94272a4

Browse files
vlakofftaylorotwell
authored andcommitted
Optimize UrlGenerator->isValidUrl() (#18566)
1 parent 0e5bf7b commit 94272a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Routing/UrlGenerator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ public function format($root, $path)
444444
*/
445445
public function isValidUrl($path)
446446
{
447-
if (! Str::startsWith($path, ['#', '//', 'mailto:', 'tel:', 'http://', 'https://'])) {
447+
if (! preg_match('~^(#|//|https?://|mailto:|tel:)~', $path)) {
448448
return filter_var($path, FILTER_VALIDATE_URL) !== false;
449449
}
450450

0 commit comments

Comments
 (0)