Make WordPress Core

Opened 3 weeks ago

Last modified 3 weeks ago

#62816 new defect (bug)

Trying to access array offset on false in /{PATH}/wp-includes/class-wp-recovery-mode-email-service.php on line 367

Reported by: afwebdev's profile afwebdev Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: Cc:

Description

In wp-includes/class-wp-recovery-mode-email-service.php on line 344, is this:

$plugin = $this->get_plugin( $extension );

however WP_Recovery_Mode_Email_Service::get_plugin() can return false, and when that happens the check null !== $plugin on line 363 passes, but then

$debug['plugin']

on line 364 causes the following error:

PHP Warning:  Trying to access array offset on false in /{PATH}/wp-includes/class-wp-recovery-mode-email-service.php on line 367

The solution is to change line 363 to:

if ( is_array( $plugin ) ) {

Change History (5)

This ticket was mentioned in PR #8141 on WordPress/wordpress-develop by @abcd95.


3 weeks ago
#1

  • Keywords has-patch added

Trac ticket: 62816

#2 @sainathpoojary
3 weeks ago

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/8141

Environment

  • WordPress: 6.8-alpha-59274-src
  • PHP: 8.2.27
  • Server: nginx/1.27.3
  • Database: mysqli (Server: 8.4.3 / Client: mysqlnd 8.2.27)
  • Browser: Chrome 132.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Four 1.3
  • MU Plugins: None activated
  • Plugins: Test Reports 1.2.0

Actual Results

✅ Issue resolved with patch.

Supplemental Artifacts

Before Fix:

https://rioudcpuyg.ufs.sh/f/PL8E4NiPUWyO8dyGJVRaQK0XFgGs8TrxlM6ny4uSRiLPVte7

After Fix: No Warnings

@ankitkumarshah commented on PR #8141:


3 weeks ago
#3

Hi @himanshupathak95,
I’ve tested the PR and here are the results:

### Before Applying the Patch:
The following warning was encountered:
### Before patch:
https://github.com/user-attachments/assets/73c5cb46-86a7-4e4e-b856-88987cdd841e

### After Applying the Patch:

  • Checked out to this PR.
  • Outcome: The warnings previously observed are no longer present.

@mukesh27 commented on PR #8141:


3 weeks ago
#5

Closing as #8143 is better approach. Feel free to reopen.

Note: See TracTickets for help on using tickets.