JasonLewis Posted July 13, 2010 Share Posted July 13, 2010 I'm curious as to how reliable some of the $_SERVER elements are, mainly the ones related to the URI and Query String. What I'm doing is building a query string using $_SERVER['QUERY_STRING'], however I'm unsure of how reliable it is I am aware that a few of the elements in the predefined variable can be unreliable, but what about the QUERY_STRING element? Cheers. Link to comment https://forums.phpfreaks.com/topic/207621-reliability-of-some-_server-elements/ Share on other sites More sharing options...
ChemicalBliss Posted July 13, 2010 Share Posted July 13, 2010 What you see is what you get on this var. Every http server needs a request uri. Therefor it will be populated in every condition except one: When a PHP script is run from a command line or similar. Although I'm pretty sure this variable still populates even under those circumstances. -cb- Link to comment https://forums.phpfreaks.com/topic/207621-reliability-of-some-_server-elements/#findComment-1085444 Share on other sites More sharing options...
AbraCadaver Posted July 13, 2010 Share Posted July 13, 2010 The $_SERVER vars are populated by the webserver, not PHP, so they are implementation dependent. Take a look at the cgi spec. I would assume that all of these will be implemented by modern webservers: http://web.archive.org/web/20071018185254/http://hoohoo.ncsa.uiuc.edu/cgi/env.html Link to comment https://forums.phpfreaks.com/topic/207621-reliability-of-some-_server-elements/#findComment-1085446 Share on other sites More sharing options...
JasonLewis Posted July 13, 2010 Author Share Posted July 13, 2010 The $_SERVER vars are populated by the webserver, not PHP, so they are implementation dependent. Take a look at the cgi spec. I would assume that all of these will be implemented by modern webservers: http://web.archive.org/web/20071018185254/http://hoohoo.ncsa.uiuc.edu/cgi/env.html Well, according to that page in regards to QUERY_STRING: This variable should always be set when there is query information, regardless of command line decoding. Very good. Thanks for that link. Thanks for your time guys. Appreciate it. Link to comment https://forums.phpfreaks.com/topic/207621-reliability-of-some-_server-elements/#findComment-1085455 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.