darya/framework

Handle URI query string when instantiating Requests

Closed this issue · 1 comments

GET requests can be created like this:

$request = new Request('/hello', 'GET', array(
    'GET' => array('this' => 'isdog')
);

But also like this:

$request = new Request('/hello?this=isnotdog', 'GET', array(
    'GET' => array('this' => 'isdog')
);

In this case, $request->uri() would evaluate to '/hello?this=isnotdog' and $request->get('this') would evaluate to 'isdog'.

Essentially, the query string of the request URI is not being handled in any way and just set as $this->data['server']['REQUEST_URI'] where $this is the Request instance.

The query string needs to be stripped and/or merged with the given GET array.

Edit: In Symfony's Request object, the URI always takes precedence.

Implemented by cbf8db4.