Comments (8)
Can you provide a concrete example?
Please note thought that one of the things I want to avoid is having to implement a custom URI parser to account for things like this. It would be slow and would be a maintenance burden. If this ends up being a limitation of PHP's parse_url, then I think we would just chalk it up as a "known issue".
from psr7.
I've experimented some more and found even more constraints to the condition. Now I'm pretty sure this should be a known issue.
I'll update the initial description with the further constraints and an example.
FWIW: My particular use case was a RESTful API with an resource id of the format <class>:<id>
specified in the URL.
Working around this problem is fairly easy: either specify a query or a fragment or at least leave a dangling question mark at the end.
from psr7.
Should I close the issue or will you close it with a particular status/label?
from psr7.
Hm... I wonder if there's something we can do here, at least for the case of combining URIs... For example, maybe we can have a special case for combining with a relative URI that starts with '/'?
from psr7.
Simple fix would be (in the context of initializing relative paths) to add a question mark if one is not already present.
if (!($rel instanceof UriInterface)) {
$rel = ($rel[0] === '/' and strpos($rel, '?') === false) ? $rel.'?' : $rel;
$rel = new self($rel);
}
from psr7.
Is there a PHP bug report for this? https://3v4l.org/QMNeo definitely seems like a PHP bug.
from psr7.
@Tobion not one that I found but parse_url
might very well have been intended to parse complete URLs (containing scheme, authentication, domain, tld, port, path, query, fragment, etc.).
Using parse_url
for relative paths could be regarded as improper usage. Which is why I didn't pursue it as a PHP bug per se.
from psr7.
But it parses relative urls correctly for the most part like //example.org
and /path
. So either it parses only absolute URIs and needs to return false for anything else. Or it must parse relative URIs correctly as well.
from psr7.
Related Issues (20)
- Code issue in LimitStream HOT 2
- Relative path with authority part present fails HOT 2
- $response->getBody()->getContents();获取到的值始终为空 HOT 1
- StreamWrapper streams are always seekable HOT 1
- Error when $version parameter is null in Message:parseRequest HOT 8
- PHP 8.2 Deprecated Messages HOT 3
- GuzzleHttp\Psr7\Message::bodySummary() incorrect cut off characters in unicode encoding HOT 1
- Missing typehints HOT 1
- GuzzleHttp\Psr7\Uri Incorrectly filled port, when converted to a string HOT 2
- Message::toString throw error when headers is list array HOT 1
- Content-Type assumption not done if the file don't have extension HOT 4
- $response->getBody()->getContents() returns empty string HOT 4
- "HTTP/2 200 is not valid header value" on 2.5.0 HOT 11
- AAC MimeType has a Typo HOT 5
- Remove ralouphie/getallheaders dependency ? HOT 5
- Exception in \GuzzleHttp\Psr7\Message::toString with poor (numeric) header HOT 3
- `Uri::__toString()` can yield malformed URIs HOT 1
- Header::parse loosing cookies with same name
- Declaration Error in GuzzleHttp\Psr7\Uri because of missing type hint for arguments. HOT 5
- summarize the multibytes(utf8) payload stream maybe cause the content unreadable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psr7.