Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#52572 closed defect (bug) (fixed)

About the wp_error parameter of the pre_reschedule_event filter

Reported by: tmatsuur's profile tmatsuur Owned by: johnbillion's profile johnbillion
Milestone: 5.7 Priority: normal
Severity: normal Version: 5.7
Component: Cron API Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

I found a little something strange in the source code of cron.php.

It is in the wp_reschedule_event function.

$pre = apply_filters( 'pre_reschedule_event', null, $event );

The comment states that the wp_error parameter has been added,
and I think the following is correct:

$pre = apply_filters( 'pre_reschedule_event', null, $event, $wp_error );

Attachments (4)

52572.diff (869 bytes) - added by mukesh27 2 years ago.
52572.2.diff (549 bytes) - added by mukesh27 2 years ago.
Updated patch.
52572.3.diff (4.6 KB) - added by johnbillion 2 years ago.
52572.4.diff (4.8 KB) - added by johnbillion 2 years ago.

Download all attachments as: .zip

Change History (12)

#1 @johnbillion
2 years ago

  • Keywords needs-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to 5.7
  • Owner set to johnbillion
  • Status changed from new to accepted

Thanks @tmatsuur! Good spot.

@mukesh27
2 years ago

#2 @mukesh27
2 years ago

  • Keywords has-patch added; needs-patch removed

52572.diff patch added.

#3 @SergeyBiryukov
2 years ago

Thanks for the patch! The alignment of the $wp_error parameter in the DocBlock should not be changed, though. It is aligned with the $pre and $event parameters above, not with the keys of the $event array.

@mukesh27
2 years ago

Updated patch.

#4 @mukesh27
2 years ago

Thanks for review. 52572.2.diff patch updated.

@johnbillion
2 years ago

#5 @johnbillion
2 years ago

  • Keywords has-unit-tests added; needs-unit-tests removed

52572.3.diff updates the existing tests to add assertions for the value of the $wp_error parameter that's passed to the filters.

@johnbillion
2 years ago

#6 follow-up: @johnbillion
2 years ago

52572.4.diff updates some formatting in the tests for consistency.

#7 in reply to: ↑ 6 @tmatsuur
2 years ago

Replying to johnbillion:

52572.4.diff updates some formatting in the tests for consistency.

Thanks @johnbillion .

I was impressed with the quick response.

#8 @johnbillion
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 50394:

Cron API: Add a missing $wp_error parameter to the pre_reschedule_event filter.

Props tmatsuur, mukesh27

Fixes #52572
See #49961

Note: See TracTickets for help on using tickets.