You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is normal to use links without absolute protocol, just: //symfony.com
After following a link without a protocol (only with double slashes), browsers will automatically detect the protocol. So it is correct to use these links. Try and see: //symfony.com
But Symfony Form UrlType adds a default protocol to these URLs (//symfony.com => http:////symfony.com).
How to reproduce
Paste //symfony.com to Form UrlType, submit the form and see what happens.
Possible Solution
In Symfony\Component\Form\Extension\Core\EventListener\FixUrlProtocolListener
Find:
if ($this->defaultProtocol && $data && \is_string($data) && !preg_match('~^[\w+.-]+://~', $data)) {
alexanevsky
changed the title
[Form] Skipped protocol "//~" is normal but not valid by FixUrlProtocolListener
[Form] Skipped URL protocol "//~" is normal but not valid by FixUrlProtocolListener
Jul 30, 2021
…antin)
This PR was merged into the 4.4 branch.
Discussion
----------
[Form] Do not fix URL protocol for relative URLs
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Tickets | Fix#42329
| Deprecations? | no
| License | MIT
Example when it doesn't work correctly:
/relative/path
The data will be changed to "http:///relative/path" (3 slashes)
Commits
-------
415dc19 [Form] Do not fix URL protocol for relative URLs
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected: <=5.3
Description
It is normal to use links without absolute protocol, just: //symfony.com
After following a link without a protocol (only with double slashes), browsers will automatically detect the protocol. So it is correct to use these links. Try and see: //symfony.com
But Symfony Form UrlType adds a default protocol to these URLs (//symfony.com => http:////symfony.com).
How to reproduce
Paste
//symfony.com
to Form UrlType, submit the form and see what happens.Possible Solution
In Symfony\Component\Form\Extension\Core\EventListener\FixUrlProtocolListener
Find:
Replace to:
The text was updated successfully, but these errors were encountered: