Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ba77bd6

Browse filesBrowse files
author
Konstantin Bogomolov
committed
Change strpos to str_contains and place it first since it is faster than preg_match
1 parent 4ae5fca commit ba77bd6
Copy full SHA for ba77bd6

File tree

1 file changed

+1
-1
lines changed
Filter options

1 file changed

+1
-1
lines changed

‎src/Symfony/Component/Form/Extension/Core/EventListener/FixUrlProtocolListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/EventListener/FixUrlProtocolListener.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function onSubmit(FormEvent $event)
3636
{
3737
$data = $event->getData();
3838

39-
if ($this->defaultProtocol && $data && \is_string($data) && !preg_match('~^[\w+.-]+://~', $data) && false === strpos($data, '/')) {
39+
if ($this->defaultProtocol && $data && \is_string($data) && !str_contains($data, '/') && !preg_match('~^[\w+.-]+://~', $data)) {
4040
$event->setData($this->defaultProtocol.'://'.$data);
4141
}
4242
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.