From 31e4c05002d098f640b042f09440f2c44df48eb4 Mon Sep 17 00:00:00 2001 From: Davo Smith Date: Thu, 16 Oct 2014 12:52:31 +0100 Subject: [PATCH] MDL-47198 filelib: fix curl handling headers with no value --- lib/filelib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/filelib.php b/lib/filelib.php index 9b1e02c443c..b5684366605 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -3056,8 +3056,9 @@ class curl { $this->responsefinished = false; $this->response = array(); } - list($key, $value) = explode(" ", rtrim($header, "\r\n"), 2); - $key = rtrim($key, ':'); + $parts = explode(" ", rtrim($header, "\r\n"), 2); + $key = rtrim($parts[0], ':'); + $value = isset($parts[1]) ? $parts[1] : null; if (!empty($this->response[$key])) { if (is_array($this->response[$key])) { $this->response[$key][] = $value;