Comments (5)
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.
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¶m=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.
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.
This will be rendered obsolete by more fundamental bootstrap fixes planned for SS4.
from silverstripe-framework.
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)
- Don't require `_config/` dir or `_config.php` file for modules HOT 4
- Session based GridField state management HOT 8
- SPIKE: Investigate ways to get configurable cache adapter prior to loading config HOT 3
- Make extension hook methods protected - part 2
- Migrate from m1/env to symfony/dotenv
- Refactor shortcode parsing HOT 2
- Move `ViewableData::Me()` out of `ViewableData` and into the template layer
- Better casting in `ViewableData`
- Default to session gridifield state manager in CMS 6
- text collector doesn't collect when parameters are passed as a variable HOT 3
- SearchableDropdownTrait::getSource doesn't respect lazy-loading HOT 5
- SQLSelect regression with subqueries HOT 16
- Deprecated getIterator function called in SSViewer_Scope HOT 2
- Permission check for 'Not strict check' is wrong AFAIK HOT 5
- Remember Me functionality fails when renewal is interrupted HOT 10
- SearchableDropdownTrait::saveInto calls DataObject::write HOT 4
- Sake script failure when PHP binary path contains spaces in SilverStripe 5.2.2 HOT 1
- Drop support for MySQL 5 in CMS 6
- `performReadonlyTransformation()` for `SearchableDropdownField` and `SearchableMultiDropdownField` doesn't respect lazy loading HOT 4
- DBForeignKey scaffolding uses wrong parameters to create SearchableDropdownField HOT 1
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 silverstripe-framework.