Remove Zend UriFactory #205
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's in this PR?
PR is primarily context to explain proposal to remove Zend UriFactory support.
Why?
The Zend UriFactory is not PSR-17 compliant in the way that it generates it's URIs.
Example:
This test case would fail as the resulting Uri will actually be
/testing
.Prepending a
/
is an assumption which has consequences - mentioned on\Psr\Http\Message\UriInterface
More info here:
https://github.com/php-fig/http-message/blob/master/src/UriInterface.php#L134
As this UriFactory is prepending a
/
and not allowing the user to handle both""
and"/"
, different UriFactories can not be used interchangeably - preventing Liskov Substitution principle here.Recently this caused us an issue where in many of our services, our new client operated as expected - primarily using versions of Guzzle. However, the Zend UriFactory was used in one of our legacy systems. Since our services have a path as part of their base_uri, this was stripped and our URIs were malformed due to prepending
/
- we addressed this issue by using league/uri.Checklist
To Do