Make WordPress Core

Ticket #47704: 47704-get_metadata.patch

File 47704-get_metadata.patch, 894 bytes (added by jrf, 6 years ago)

PHP 7.4/array-access: Fix get_metadata() - fixes 1 error

  • src/wp-includes/meta.php

    From cb916179919facc26e846d493d2287caeb1a340b Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Mon, 15 Jul 2019 01:13:21 +0200
    Subject: [PATCH] PHP 7.4/array-access: Fix get_metadata()
    
    ---
     src/wp-includes/meta.php | 6 +++++-
     1 file changed, 5 insertions(+), 1 deletion(-)
    
    diff --git a/src/wp-includes/meta.php b/src/wp-includes/meta.php
    index 5446c16d3e..9bd989540c 100644
    a b function get_metadata( $meta_type, $object_id, $meta_key = '', $single = false ) 
    523523
    524524        if ( ! $meta_cache ) {
    525525                $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
    526                 $meta_cache = $meta_cache[ $object_id ];
     526                if ( isset( $meta_cache[ $object_id ] ) ) {
     527                        $meta_cache = $meta_cache[ $object_id ];
     528                } else {
     529                        $meta_cache = null;
     530                }
    527531        }
    528532
    529533        if ( ! $meta_key ) {