From 9e49ba8a97a9e0d7ea4073f53afdec8f7c1b6d51 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Fri, 14 Dec 2018 05:54:34 +0000 Subject: [PATCH] Meta Boxes: Fix error when a meta box is rendered with a static method callback. When `WP_DEBUG` is set, ensure that a static method callback is passed to `ReflectionMethod`, instead of `ReflectionFunction`. Merges [43830] from the 5.0 branch to trunk. Props DrewAPicture. Fixes #45192. git-svn-id: https://develop.svn.wordpress.org/trunk@44170 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/template.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php index a1cd160076..58505fa9f4 100644 --- a/src/wp-admin/includes/template.php +++ b/src/wp-admin/includes/template.php @@ -1187,6 +1187,8 @@ function do_meta_boxes( $screen, $context, $object ) { if ( WP_DEBUG && ! $screen->is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) { if ( is_array( $box['callback'] ) ) { $reflection = new ReflectionMethod( $box['callback'][0], $box['callback'][1] ); + } elseif ( false !== strpos( $box['callback'], '::' ) ) { + $reflection = new ReflectionMethod( $box['callback'] ); } else { $reflection = new ReflectionFunction( $box['callback'] ); }