WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 4 months ago

#52572 closed defect (bug) (fixed)

About the wp_error parameter of the pre_reschedule_event filter

Reported by: tmatsuur Owned by: 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 4 months ago.
52572.2.diff (549 bytes) - added by mukesh27 4 months ago.
Updated patch.
52572.3.diff (4.6 KB) - added by johnbillion 4 months ago.
52572.4.diff (4.8 KB) - added by johnbillion 4 months ago.

Download all attachments as: .zip

Change History (12)

#1 @johnbillion
4 months 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
4 months ago

#2 @mukesh27
4 months ago

  • Keywords has-patch added; needs-patch removed

52572.diff patch added.

#3 @SergeyBiryukov
4 months 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
4 months ago

Updated patch.

#4 @mukesh27
4 months ago

Thanks for review. 52572.2.diff patch updated.

@johnbillion
4 months ago

#5 @johnbillion
4 months 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
4 months ago

#6 follow-up: @johnbillion
4 months ago

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

#7 in reply to: ↑ 6 @tmatsuur
4 months 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
4 months 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.