$request->server() should not auto html-escape values. header() however should.
Also introduce some tests for this behaviour.
Thanks to nn- for catching this.
PHPBB3-9716
Extend the request class with helpers for reading server vars (server())
and HTTP request headers (header()). Refactor the existing code base
to make use of these helpers, make $_SERVER a deactivated super global.
Also introduce an is_ajax() method, which checks the X-Requested-With
header for the value 'XMLHttpRequest', which is sent by JavaScript
libraries, such as jQuery.
PHPBB3-9716
All class names have been adjusted to use a phpbb_request prefix,
allowing them to be autoloaded.
Also introduces some improvements to autoloading in general.
PHPBB3-9716
To save users from having to run everything through
utf8_normalize_nfc(), a call is done automatically from within set_var,
which is called by request_var.
PHPBB3-9716
The request class
- now makes use of the new type cast helper (dependency injection)
- has no static methods anymore.
- now has a constructor argument to leave super globals turned on
Brought back the set_var function in functions.php. It is now a wrapper
around the type cast helper. It creates an instance on the fly.
The request_var wrapper function now has an optional last argument to
inject the request class instance, rather than abusing the $var_name.
PHPBB3-9716
These methods should be available without having to instantiate a request class
object, better separation of concerns. A set_var wrapper around this class no
longer requires a request object at all.
PHPBB3-9716
The well known request_var function is now a wrapper that calls a method
on a phpbb_request object. The class provides additional functionality.
It can replace all super globals with special objects that throw errors
when being accessed. They still allow isset operations to keep backward
compatibility with isset($_POST['var']) checks. The phpbb_request class
implements the phpbb_request_interface which is available for easy mocking
of input in tests.
PHPBB3-9716