From 847a0d51f0f0c35ce71525607cc3642a29fbb5a7 Mon Sep 17 00:00:00 2001 From: KnifeLemon Date: Fri, 17 Oct 2025 10:49:56 +0900 Subject: [PATCH] fix: add null coalescing for undefined superglobals --- flight/net/Request.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flight/net/Request.php b/flight/net/Request.php index 08090cb..4341b08 100644 --- a/flight/net/Request.php +++ b/flight/net/Request.php @@ -177,10 +177,10 @@ class Request 'user_agent' => $this->getVar('HTTP_USER_AGENT'), 'type' => $this->getVar('CONTENT_TYPE'), 'length' => intval($this->getVar('CONTENT_LENGTH', 0)), - 'query' => new Collection($_GET), - 'data' => new Collection($_POST), - 'cookies' => new Collection($_COOKIE), - 'files' => new Collection($_FILES), + 'query' => new Collection($_GET ?? []), + 'data' => new Collection($_POST ?? []), + 'cookies' => new Collection($_COOKIE ?? []), + 'files' => new Collection($_FILES ?? []), 'secure' => $scheme === 'https', 'accept' => $this->getVar('HTTP_ACCEPT'), 'proxy_ip' => $this->getProxyIpAddress(), @@ -219,7 +219,7 @@ class Request $this->url = '/'; } else { // 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); } @@ -546,7 +546,7 @@ class Request $contentType = strtolower(trim($this->type)); $isMultipart = strpos($contentType, 'multipart/form-data') === 0; $boundary = null; - + if ($isMultipart) { // Extract boundary more safely if (preg_match('/boundary=(["\']?)([^"\';,\s]+)\1/i', $this->type, $matches)) {