Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / zendframework / zend-diactoros / src / ServerRequest.php
index 0ac788690c4ba21222396d881619b1d4dd9605c0..8523d59e1a5ea8dd5267d4d6da1cb7d34f60719b 100644 (file)
@@ -13,6 +13,9 @@ use Psr\Http\Message\StreamInterface;
 use Psr\Http\Message\UploadedFileInterface;
 use Psr\Http\Message\UriInterface;
 
+use function array_key_exists;
+use function is_array;
+
 /**
  * Server-side HTTP request
  *
@@ -177,6 +180,14 @@ class ServerRequest implements ServerRequestInterface
      */
     public function withParsedBody($data)
     {
+        if (! is_array($data) && ! is_object($data) && null !== $data) {
+            throw new InvalidArgumentException(sprintf(
+                '%s expects a null, array, or object argument; received %s',
+                __METHOD__,
+                gettype($data)
+            ));
+        }
+
         $new = clone $this;
         $new->parsedBody = $data;
         return $new;