Skip to content

Commit bff31ca

Browse files
Site Health: Check plugin data in WP_Recovery_Mode_Email_Service::get_debug().
This resolves a PHP warning when preparing debug information for the fatal error protection email if `::get_plugin()` returned `false` due to the failing plugin not being found. Follow-up to [46273]. Props mukesh27, afwebdev, abcd95, sainathpoojary, ankitkumarshah, SergeyBiryukov. Fixes #62816. git-svn-id: https://develop.svn.wordpress.org/trunk@61448 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 0fb3bb2 commit bff31ca

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/wp-includes/class-wp-recovery-mode-email-service.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,6 @@ private function get_debug( $extension ) {
340340
$theme = wp_get_theme();
341341
$wp_version = get_bloginfo( 'version' );
342342

343-
if ( $extension ) {
344-
$plugin = $this->get_plugin( $extension );
345-
} else {
346-
$plugin = null;
347-
}
348-
349343
$debug = array(
350344
'wp' => sprintf(
351345
/* translators: %s: Current WordPress version number. */
@@ -360,13 +354,17 @@ private function get_debug( $extension ) {
360354
),
361355
);
362356

363-
if ( null !== $plugin ) {
364-
$debug['plugin'] = sprintf(
365-
/* translators: 1: The failing plugins name. 2: The failing plugins version. */
366-
__( 'Current plugin: %1$s (version %2$s)' ),
367-
$plugin['Name'],
368-
$plugin['Version']
369-
);
357+
if ( $extension ) {
358+
$plugin = $this->get_plugin( $extension );
359+
360+
if ( is_array( $plugin ) ) {
361+
$debug['plugin'] = sprintf(
362+
/* translators: 1: The failing plugin's name. 2: The failing plugin's version. */
363+
__( 'Current plugin: %1$s (version %2$s)' ),
364+
$plugin['Name'],
365+
$plugin['Version']
366+
);
367+
}
370368
}
371369

372370
$debug['php'] = sprintf(

0 commit comments

Comments
 (0)