fix: add null coalescing for undefined superglobals

pull/664/head
KnifeLemon 3 weeks ago
parent 68b9306d30
commit 847a0d51f0

@ -177,10 +177,10 @@ class Request
'user_agent' => $this->getVar('HTTP_USER_AGENT'), 'user_agent' => $this->getVar('HTTP_USER_AGENT'),
'type' => $this->getVar('CONTENT_TYPE'), 'type' => $this->getVar('CONTENT_TYPE'),
'length' => intval($this->getVar('CONTENT_LENGTH', 0)), 'length' => intval($this->getVar('CONTENT_LENGTH', 0)),
'query' => new Collection($_GET), 'query' => new Collection($_GET ?? []),
'data' => new Collection($_POST), 'data' => new Collection($_POST ?? []),
'cookies' => new Collection($_COOKIE), 'cookies' => new Collection($_COOKIE ?? []),
'files' => new Collection($_FILES), 'files' => new Collection($_FILES ?? []),
'secure' => $scheme === 'https', 'secure' => $scheme === 'https',
'accept' => $this->getVar('HTTP_ACCEPT'), 'accept' => $this->getVar('HTTP_ACCEPT'),
'proxy_ip' => $this->getProxyIpAddress(), 'proxy_ip' => $this->getProxyIpAddress(),
@ -219,7 +219,7 @@ class Request
$this->url = '/'; $this->url = '/';
} else { } else {
// Merge URL query parameters with $_GET // Merge URL query parameters with $_GET
$_GET = array_merge($_GET, self::parseQuery($this->url)); $_GET = array_merge($_GET ?? [], self::parseQuery($this->url));
$this->query->setData($_GET); $this->query->setData($_GET);
} }

Loading…
Cancel
Save