![]() |
get_request_header broken - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19) +--- Thread: get_request_header broken (/showthread.php?tid=61953) |
get_request_header broken - boonstoppel - 06-03-2015 hi, with the new version 3.0 the method input->get_request_header does not work properly anymore. There seem to be different formatting options on different servers to get a property from the HTTP headers. Eg. to get custom HTTP header property "X-APP-IDENTIFIER" some server environments provide it as "X-App-Identifier" some as "X-APP-IDENTIFIER" and some all lowercase as "x-app-identifier". I wrote a work around method to check all variants as followed: public function get_request_header($name) { $request = $this->_obj->input->get_request_header($name, TRUE); if ($request) { return $request; } $request = $this->_obj->input->get_request_header(strtolower($name), TRUE); if ($request) { return $request; } $key = strtoupper($name); return array_key_exists($key, $_SERVER) && $_SERVER[$key] ? $_SERVER[$key] : NULL; } I would be nice to have codigniter take care of this, so that there is a unified way of getting these properties. |