Skip to content

Version 7.8.0 has a regression in URI resolution #184

Description

@stof

Bug Report

Information Description
Package league/uri
Version 7.8.0
PHP version 8.4.18
OS Platform Ubuntu

Summary

Version 7.8.0 breaks the resolution of some references, making it incompatible with RFC 3986

Standalone code, or other way to reproduce the problem

use League\Uri\Uri;

$base = Uri::new('http://a/b/c/d;p?q')

var_dump($base->resolve(Uri::new('g:h')->toString());

$base2 = Uri::new('foo://a/b/c/d;p?q');

var_dump($base2->resolve(Uri::new('foo:g')->toString());

Expected result

The first dump should produce g:h and the second dump should produce foo:g.

Those test cases are coming directly from examples defined in RFC 3986.
The first failing case is the first normal example of the RFC verbatim.
The second failing case corresponds to the last abnormal example of the RFC, adapted to use the scheme foo rather than http. This adaptation is necessary to avoid an error for http:g as league/uri has a validation enforcing the usage of a hierarchical URL for the http scheme (as well as a few others), which is not the case in the example (but the fact that http is expected to be hierarchical comes from a different RFC. RFC 3986 does not define the semantic of the http scheme and so could have use any scheme in its example).

Actual result

As 7.8.0, this returns g:/h and foo:/g. The behavior was correct in 7.7.0 and older.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions