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

[BCBreak][DomCrawler] UriResolver is broken with non-url format #52628

Copy link
Copy link
Closed
@lyrixx

Description

@lyrixx
Issue body actions

Symfony version(s) affected

not releases yet - but 6.4 - but 6.3.next

Description

This PR introduced a BC break : #52579

script:

#!/usr/bin/env php
<?php

require __DIR__ . '/src/Symfony/Component/DomCrawler/vendor/autoload.php';

$ret =  Symfony\Component\DomCrawler\UriResolver::resolve('https://', 'https://jolicode.com/');

echo "$ret\n";

Before:

On 0a30c9b (direct parent)

php test.php 
https://

After

on 89009aa:

$ php test.php 
https://jolicode.com/https://

How does a browser react?

Note: on a webpage, if I put <a href="http://">test</a>, and I click on it, I'll land on about:blank#blocked (at least in chrome), not on https://jolicode.com/https://

cc @vdauchy

Some context

On seriously malformed URLs, parse_url() may return false.
(from https://www.php.net/manual/en/function.parse-url.php)

and

$t = [
    'http://jolicode.com',
    'http://',
    'foobar',
    '/bar',
    '/bar:1',
];

foreach ($t as $uri) {
    $o[$uri] = parse_url($uri, \PHP_URL_SCHEME);
}

dump($o);

returns

$ ./test.php
^ array:5 [
  "http://jolicode.com" => "http"
  "http://" => false
  "foobar" => null
  "/bar" => null
  "/bar:1" => false
]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

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