GithubHelp home page GithubHelp logo

Comments (5)

silverstripe-issues avatar silverstripe-issues commented on July 1, 2024

comment by: @chillu (ischommer)
created at: 2011-04-07


We'd have to be very careful with REQUEST_URI across server and fastCGI implementations, e.g. IIS7 seems to make problems: http://support.microsoft.com/kb/954946

Sean, what do you think?

from silverstripe-framework.

silverstripe-issues avatar silverstripe-issues commented on July 1, 2024

comment by: paradigmincarnate
created at: 2011-04-07


I looked at that microsoft bug you mentioned. The problem is IIS 7 only returns the path, not the query.

If REQUEST_URI is used, the query would have to be removed anyway, as SilverStripe expects the url to only be the path component.

The following would work across apache, IIS 6, IIS 7

$url = array_shift(explode('?', $_SERVER['REQUEST_URI']));

Regarding other http servers, sapphire/main.php already contains server-specific "fixes", so I don't see that as a hurdle. I guess the difference is we'd be fixing things to work correctly, instead of normalizing them to an incorrect.

If you're considering moving away from using $_GET['url'], the following argument may help sway you.

An example situation of where putting the url into the query will fail:

http://www.example.com/segment%2Fone/segment-two?param=value

An .htaccess will rewrite this to:

http://www.example.com/sapphire/main.php?url=segment%2fone/segment-two&param=value

PHP will further decode this into the $_GET superglobal.

print_r($_GET);
// Array
// (
//   [url] => segment/one/segment-two
//   [param] => value
// )

As you can see, it thinks there are 3 segments in the path: "segment", "one", and "segment-two".

In fact we had only 2 segments: "segment%2Fone", and "segment-two".

If necessary I can provide other examples cases, such as using "&" or "+" in the path (which is otherwise legal).

from silverstripe-framework.

silverstripe-issues avatar silverstripe-issues commented on July 1, 2024

comment by: @chillu (ischommer)
created at: 2011-04-07


I don't think we'll be able to completely do away with $_GET['url'], as we're technically supporting routing without rewriting: index.php?url=home/ - but that might just mean setting the REQUEST_URI manually in index.php, and removing $_GET['url'] from main.php/cli-script.php

from silverstripe-framework.

sminnee avatar sminnee commented on July 1, 2024

This will be rendered obsolete by more fundamental bootstrap fixes planned for SS4.

from silverstripe-framework.

tractorcow avatar tractorcow commented on July 1, 2024

Surely the easiest way to fix this is to replace all use of $_REQUEST['url'] with $_GET['url'] or SS_HTTPRequest::getUrl()

I might do this in a separate pull request anyway, along with other direct access to $_SERVER variable.

from silverstripe-framework.

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.