No description
- PHP 100%
| lib | ||
| polyfill | ||
| scripts | ||
| tests | ||
| vendor-bin/phpunit | ||
| .gitignore | ||
| composer.json | ||
| composer.lock | ||
| docker-compose.yaml | ||
| LICENSE | ||
| README.md | ||
URI extension polyfill
A polyfill for the PHP URI extension introduced in PHP 8.5. All features as of PHP 8.5.8 are replicated.
Features
- Compatibility back to PHP 7.1
- Passes all
urltestdata.jsonWeb Platform tests - Passes most PHP tests (see Differences below)
- Requires no PHP extensions
Differences
- The
Uri\Rfc3986\UriandUri\WhatWg\Urlclasses are neither final nor read-only Uri\Rfc3986\UriandUri\WhatWg\Urlobject serialization differ and are subject to change- Performing
var_export()onUri\Rfc3986\UriandUri\WhatWg\Urlobjects will yield different results - Casting
Uri\Rfc3986\UriandUri\WhatWg\Urlto array will yield different results - When using PHP 8.0 or earlier
Uri\UriComparisonModeandUri\WhatWg\UrlValidationErrorTypeare classes with a series of string constants rather than enumerations. - Where the enumerations
Uri\UriComparisonModeandUri\WhatWg\UrlValidationErrorTypeare used as parameter types, their types are not enforced - The result of converting an internationalized domain name to ASCII may differ
- The following PHP bugs are preemptively fixed:
- GH-22608: ext/uri: RFC 3986 initial-double-dot path can yield incorrect normalization
- GH-22618: ext/uri: RFC 3986 IPv6 handling is inconsistent
- GH-22628: ext/uri: Percent-encoding of caret in WHATWG URL paths is not performed
- GH-22629: ext/uri: WHATWG Validation error incorrect with empty host and non-empty userinfo
Availability
The polyfill is available on Packagist as mensbeam/uri, with source code available on my personal repository and mirrored on Codeberg.