Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / zendframework / zend-diactoros / src / MessageTrait.php
index 5f506207e92cbcde23f39f1d46fe942dd2586534..6b83be4655a8d5584656469ad4b502b53a176d5d 100644 (file)
@@ -10,6 +10,19 @@ namespace Zend\Diactoros;
 use InvalidArgumentException;
 use Psr\Http\Message\StreamInterface;
 
+use function array_map;
+use function array_merge;
+use function get_class;
+use function gettype;
+use function implode;
+use function is_array;
+use function is_object;
+use function is_resource;
+use function is_string;
+use function preg_match;
+use function sprintf;
+use function strtolower;
+
 /**
  * Trait implementing the various methods defined in MessageInterface.
  *
@@ -372,11 +385,18 @@ trait MessageTrait
             $values = [$values];
         }
 
+        if ([] === $values) {
+            throw new InvalidArgumentException(
+                'Invalid header value: must be a string or array of strings; '
+                . 'cannot be an empty array'
+            );
+        }
+
         return array_map(function ($value) {
             HeaderSecurity::assertValid($value);
 
             return (string) $value;
-        }, $values);
+        }, array_values($values));
     }
 
     /**