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)
- Run CanonicalURLMiddleware in dev / test. HOT 2
- Add Nice() to DBField HOT 10
- BUG Eager loading with multiple objects pointing to the same has_one trigger extra db fetch HOT 1
- TimeField should deal better with partial times HOT 1
- Improve phpdoc types HOT 2
- GridField breadcrumbs may use incorrect casting for titles
- Revert TinyMCE config bugfix prior to CMS 5.2 release HOT 2
- ClassInfo::hasTable could be cached on dev/build HOT 3
- ImageBackend 'auto' driver HOT 5
- Invalid french translation in ChangePasswordEmail HOT 1
- Duplicate field in `many_many_extraFields` causing "ClassName" unknown field error HOT 1
- `GridField` escapes HTML content inappropriately HOT 11
- Polymorphic has_many relation query is too ambiguous HOT 2
- Ability to loop through containers containing primitives in Silverstripe templates HOT 4
- OutOfBoundsException thrown when recipe-core isn't installed HOT 1
- Strongly type FieldList HOT 1
- summary_fields in GridField escape html incorrectly HOT 4
- Add support for polymorphic has_one to eager loading HOT 1
- SS4 - Cannot update password if the email is email is a non-email format HOT 1
- HTMLEditorField is not able to show html/xml code examples HOT 2
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.