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
|
b
|
class WP_REST_Request implements ArrayAccess { |
294 | 294 | * |
295 | 295 | * @since 4.4.0 |
296 | 296 | * |
297 | | * @return array Map containing 'value' and 'parameters' keys. |
| 297 | * @return array|null Map containing 'value' and 'parameters' keys |
| 298 | * or null when no valid content-type header was |
| 299 | * available. |
298 | 300 | */ |
299 | 301 | public function get_content_type() { |
300 | 302 | $value = $this->get_header( 'content-type' ); |
… |
… |
class WP_REST_Request implements ArrayAccess { |
334 | 336 | $order = array(); |
335 | 337 | |
336 | 338 | $content_type = $this->get_content_type(); |
337 | | if ( $content_type['value'] === 'application/json' ) { |
| 339 | if ( isset( $content_type['value'] ) && 'application/json' === $content_type['value'] ) { |
338 | 340 | $order[] = 'JSON'; |
339 | 341 | } |
340 | 342 | |