Browse code

Elimination of notice in Request class

RafaƂ Szklarczyk authored on 24/07/2019 08:53:28
Showing 1 changed files
... ...
@@ -15,10 +15,10 @@ class Request{
15 15
         if(isset($_GET['path']))
16 16
             $this->path = $_GET['path'];
17 17
         $this->method = $_SERVER['REQUEST_METHOD'];
18
-        $this->accept = $_SERVER['HTTP_ACCEPT'];
18
+        $this->accept = isset($_SERVER['HTTP_ACCEPT'])?$_SERVER['HTTP_ACCEPT']:"";
19 19
         $this->acceptTypes = $this->parseAccept($this->accept);
20 20
         $this->acceptLanguage = isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])?$_SERVER['HTTP_ACCEPT_LANGUAGE']:"";
21
-        $this->userAgent = $_SERVER['HTTP_USER_AGENT'];
21
+        $this->userAgent = isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:null;
22 22
         if(function_exists('apache_request_headers')){
23 23
             $this->headers = apache_request_headers();
24 24
         }