Skip to content

Commit 39cb14a

Browse files
committed
Check if $_SERVER['QUERY_STRING'] exists before using it
1 parent 3682ec0 commit 39cb14a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/MiladRahimi/PHPRouter/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private function __construct(Router $router)
129129
$this->router = $router;
130130
$u = $_SERVER["REQUEST_URI"];
131131
$this->uri = $u ? urldecode($u) : null;
132-
$q = $this->query_string = $_SERVER["QUERY_STRING"] ?: null;
132+
$q = $this->query_string = empty($_SERVER["QUERY_STRING"]) ? null : $_SERVER["QUERY_STRING"];
133133
$this->page = trim(substr($u, 0, strlen($u) - strlen($q)), '?');
134134
$this->method = $_SERVER["REQUEST_METHOD"];
135135
$this->protocol = $_SERVER["SERVER_PROTOCOL"];

0 commit comments

Comments
 (0)