Giter Club home page Giter Club logo

Comments (5)

GrahamCampbell avatar GrahamCampbell commented on May 21, 2024

I think this is because the path you've provided contains invalid characters - you can't use a colon. Replace all the colons with %3A and it should work.

from psr7.

GrahamCampbell avatar GrahamCampbell commented on May 21, 2024

Browsers render %3A as :, which can be confusing, but they actually send %3A to servers.

from psr7.

hlubek avatar hlubek commented on May 21, 2024

Hi, thanks for the swift reply!

Well, it is not invalid according to https://datatracker.ietf.org/doc/html/rfc3986#appendix-A which includes colons for path segments in this scenario. I would expect Uri to be standards compliant here.

Additionally it's not that colons generally cause this issue. It's only if paired with a number - I guess it's because parse_url is just not meant for URIs but only full URLs and gets confused by an apparent host / port.

from psr7.

GrahamCampbell avatar GrahamCampbell commented on May 21, 2024

There's not much other option if you want to not pass a valid URI through to the Url class (just the path component of a URI is not a URI). Parse URL is not mis-interpreting it - it just is not meant to be given just a path. ;)

from psr7.

hlubek avatar hlubek commented on May 21, 2024

RFC 3986 defines URI and URI reference (but most people probably do not distinguish between them). Since test cases for the Uri class accept input values consisting only of paths it is already implying to support URI references (which is a superset of URI) I'd say. I couldn't find an explicit definition of this in https://www.php-fig.org/psr/psr-7/ though.

So I would still say this is a bug in the Uri class because it uses parse_url behind the scenes (which works okay for most scenarios).

I think we can work around this issue for now, but I wanted to raise this issue for the PSR-7 implementation to be more compliant to the web standard here.

from psr7.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.