summaryrefslogtreecommitdiffstats
path: root/php-sabre-http-php74.patch
blob: 9a85b11d1cb2baa952fb1b2d29bf728686eff457 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Adapted for v4 from:

From 987e14a077fca2d950bc9f555173fa7bb71c0096 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@famillecollet.com>
Date: Wed, 11 Sep 2019 14:31:57 +0200
Subject: [PATCH] fix "Trying to access array offset on value of type bool" in
 7.4 (#121)

---
 lib/Auth/Digest.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/Auth/Digest.php b/lib/Auth/Digest.php
index 23c28f8..dd35a0b 100644
--- a/lib/Auth/Digest.php
+++ b/lib/Auth/Digest.php
@@ -124,7 +124,7 @@ class Digest extends AbstractAuth {
      */
     function getUsername() {
 
-        return $this->digestParts['username'];
+        return (isset($this->digestParts['username']) ? $this->digestParts['username'] : null);
 
     }
 
@@ -135,6 +135,10 @@ class Digest extends AbstractAuth {
      */
     protected function validate() {
 
+        if (!is_array($this->digestParts)) {
+            return false;
+        }
+
         $A2 = $this->request->getMethod() . ':' . $this->digestParts['uri'];
 
         if ($this->digestParts['qop'] == 'auth-int') {