Sfoglia il codice sorgente

修复PHP Warning: Undefined array key警告

chengyao 3 anni fa
parent
commit
99b24a3eb7
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      src/Protocols/Http/Response.php

+ 1 - 1
src/Protocols/Http/Response.php

@@ -409,7 +409,7 @@ class Response
             return $this->createHeadForFile($this->file);
         }
 
-        $reason = $this->_reason ?: static::$_phrases[$this->_status];
+        $reason = $this->_reason ?: static::$_phrases[$this->_status] ?? '';
         $body_len = \strlen($this->_body);
         if (empty($this->_header)) {
             return "HTTP/{$this->_version} {$this->_status} $reason\r\nServer: workerman\r\nContent-Type: text/html;charset=utf-8\r\nContent-Length: $body_len\r\nConnection: keep-alive\r\n\r\n{$this->_body}";