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.
Bug Report
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
Expected result
The first dump should produce
g:hand the second dump should producefoo: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
foorather thanhttp. This adaptation is necessary to avoid an error forhttp:gasleague/urihas a validation enforcing the usage of a hierarchical URL for thehttpscheme (as well as a few others), which is not the case in the example (but the fact thathttpis expected to be hierarchical comes from a different RFC. RFC 3986 does not define the semantic of thehttpscheme and so could have use any scheme in its example).Actual result
As 7.8.0, this returns
g:/handfoo:/g. The behavior was correct in 7.7.0 and older.