Skip to content

Commit 211aad8

Browse files
committed
Fixed notices in Request::createFromGlobals().
1 parent e904db3 commit 211aad8

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/Darya/Http/Request.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ class Request {
7070
* @return \Darya\Http\Request
7171
*/
7272
public static function createFromGlobals(SessionInterface $session = null) {
73-
$uri = $_SERVER['REQUEST_URI'];
74-
$method = strtolower($_SERVER['REQUEST_METHOD']);
73+
$uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
74+
$method = isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) : 'get';
7575

7676
$request = new static($uri, $method, array(
77-
'get' => $_GET,
78-
'post' => $_POST,
79-
'cookie' => $_COOKIE,
80-
'file' => $_FILES,
81-
'server' => $_SERVER,
77+
'get' => $_GET ?: array(),
78+
'post' => $_POST ?: array(),
79+
'cookie' => $_COOKIE ?: array(),
80+
'file' => $_FILES ?: array(),
81+
'server' => $_SERVER ?: array(),
8282
'header' => static::headersFromGlobals($_SERVER)
8383
));
8484

0 commit comments

Comments
 (0)