I’ve extended the Input class with a get() method, because there’s no good reason to kill query strings, just because they can be abused. Remember that “Code Igniter is right for you if... [you] want a framework that does not require you to adhere to restrictive coding rules.”
I don’t know how many people are actually using query strings with CI, because it doesn’t work well, but I’ve got them covered as well with a router change that allows segment data, and the use of the URL helper because you can use URIs like: ‘/index.php?/controller/method/segment?query=foo’
There’s also a bug (when the magic quotes misfeature is enabled) in the CI_Input methods that run stripslashes on the keys of superglobals when they are retrieved, but not the values... a big problem when the database class once-again escapes strings in SQL statements.
To start using this fix/extension, download this ZIP file. This compressed application folder contains the required MY_Input and MY_Router libraries, an example set of additions to config.php, as well as a basic controller (Ir—Input/Routing) and view for testing.
UPDATE: The input class also now has _list, functions for each method, e.g. get_list(). It accepts a variable length argument list, and there are three ways to use it:
Usage 1: get_list(array(‘username’, ‘password’, ‘passconf’)[, true])
arg1 (array): Required. List of keys to retrieve values from.
arg2 (bool): Optional, default FALSE. Toggle cross-site scripting filter
Usage 2: get_list(‘username,password,passconf’[, true])
arg1 (string): Required. A comma-delimited list of keys to retrieve values from.
arg2 (bool): Optional, default FALSE. Toggle cross-site scripting filter
Usage 3: get_list(‘username’, ‘password’, ‘passconf’[, true])
arg1… Keys to retrieve values from
lastarg: Optional, default FALSE. Toggle cross-site scripting filter
UPDATE: Query string routing is an OPTION. It was a simple change that came along for the ride in fixing the input class. One further update I may end up making is to eliminate the query string routing config option and just detect the setting based on the last character of index page.
UPDATE #34480227: The current version does not try to reproduce the original code, unlike the original proof-of-concept. It also solves the bug that causes CI to not report rsegment #2 when the index method is used.
