From b68f36f98b7a106f6ce2186f7f00473df8385321 Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Sun, 14 Jul 2019 22:22:14 +0200
Subject: [PATCH] PHP 7.4/array-access: Fix WP_REST_Request::get_content_type()

---
 src/wp-includes/rest-api/class-wp-rest-request.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/wp-includes/rest-api/class-wp-rest-request.php b/src/wp-includes/rest-api/class-wp-rest-request.php
index ee106b5c5a..3089547ce7 100644
--- a/src/wp-includes/rest-api/class-wp-rest-request.php
+++ b/src/wp-includes/rest-api/class-wp-rest-request.php
@@ -294,7 +294,9 @@ class WP_REST_Request implements ArrayAccess {
 	 *
 	 * @since 4.4.0
 	 *
-	 * @return array Map containing 'value' and 'parameters' keys.
+	 * @return array|null Map containing 'value' and 'parameters' keys
+	 *                    or null when no valid content-type header was
+	 *                    available.
 	 */
 	public function get_content_type() {
 		$value = $this->get_header( 'content-type' );
@@ -334,7 +336,7 @@ class WP_REST_Request implements ArrayAccess {
 		$order = array();
 
 		$content_type = $this->get_content_type();
-		if ( $content_type['value'] === 'application/json' ) {
+		if ( isset( $content_type['value'] ) && 'application/json' === $content_type['value'] ) {
 			$order[] = 'JSON';
 		}
 
-- 
2.21.0.windows.1

