Skip to content

Empty $_SERVER['QUERY_STRING'], which is used by \yii\web\Request #15

Closed
@ebuzzz

Description

@ebuzzz

At the moment, the connector initializes the following $_SERVER properties before doing a request:

$_SERVER['REQUEST_URI'] = $queryString === null ? $pathString : $pathString . '?' . $queryString;
$_SERVER['REQUEST_METHOD'] = strtoupper($request->getMethod());

But the \yii\web\Request::getQueryString() method (and other parts of the Request class) searches for the $_SERVER['QUERY_STRING'] value, which is never set during tests. During normal operation of the application through the webserver, this value is available. This is resulting in failed tests for code that works fine during normal operation.

I fixed this issue on my end by adding the line;

$_SERVER['QUERY_STRING'] = $queryString;

But I'm not sure if there are any side-effects to this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions