-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URI schemas incorrectly validated with FILTER_VALIDATE_URL #685
Comments
I've done some research in an attempt to move the issue forward.
It seems the issue report is valid and a fix is desirable. PR's are welcome. |
@DannyvdSluijs For what it's worth, if you can find a suitable library that has >=5.6 compat, that will be OK. I think we can safely drop support for versions older than 5.6. |
Hi @DannyvdSluijs , I see that this issue was scheduled for triage. May I ask an update on your findings and decisions, please? It is a blocker to us for a long time. Is there a clear path to move forward based on your findingins in #685 (comment)? If yes, Pronovix might be able to help with raising a PR. |
What about Guzzle's PSR7 library? >=2.4.5's current support range is https://packagist.org/packages/guzzlehttp/psr7 Based on my dummy test, it also parses the URI in the bug report correctly:
|
@boobaa thanks for the ping. The state of this issue is I do think we are making progress, three weeks ago 31 issues where closed. Maybe we are not yet at the speed we would like to be but I'll trust that time will resolve that. In the meantime feel free to help with the research, search for options or even go as far and create a PR if you feel comfortable enough. I'm available for reviewing and helping out. The input from @mrix seems helpfull and can be a step in the right direction, combined with our (current) desire to support older version PHP maybe it is worth looking into the 1.x branch of |
Well, at least Guzzle PSR7 1.x is still supported in some sense... So if this lib would support both 1.x and 2.x at the same time, that could lead to a solution where both older PHP versions are supported and up to date applications can depend on justinrainbow/json-schema without any dependency issues.
What is the lowest PHP version that this lib would like to support, and why? Due to Zend LTS versions? |
This repo is a dependency of Composer. Supporting both 1.x and 2.x would be fine I guess as long as this specific class behaves the same and the code in this repo doesn't have to be aware of any v1 or v2 things. |
Also affects Drupal: https://www.drupal.org/project/experience_builder/issues/3466042#comment-15713980. |
Hi,
The
uri
,uriref
anduri-reference
type of fields are incorrectly being validated withfilter_var($element, FILTER_VALIDATE_URL);
as this php function validates only URLs and it does not (cannot) validate URIs.So while the
https://example.com
is a valid URL theurn:oasis:names:specification:docbook:dtd:xml:4.1.2
is not, however it is a valid URI. Therefore these kind of fields should be validated differently, php does not have built-in functionality to do this.In the related php ticket it is being mentioned that URIs could be validated simply as
<scheme>:<extra>
or implement RFC 3986.Example JSON document that can cause a validation error.
Example script to reproduce the issue.
The validation error is:
[components.schemas.exampleXml.xml.namespace] Invalid URL format
.(Unrelated but there is also a
[components.schemas.exampleXml.$ref] The property $ref is required
validation error, however it is not being marked as an issue for example by https://editor.swagger.io/)Related:
The text was updated successfully, but these errors were encountered: