Make WordPress Core

Opened 8 years ago

Closed 6 years ago

Last modified 6 years ago

#39052 closed defect (bug) (fixed)

Correct return value and documentation of wp_unschedule_event

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

Description

A few weeks ago, when looking through the cron implementation, I noticed that the documentation for the @return value of wp_unschedule_event() function doesn't quite match what actually gets return.

For example, the documentation is @return false|void False if the event does not get unscheduled..

But, the function really only returns false if this condition is truthy:

if ( ! is_numeric( $timestamp ) || $timestamp <= 0 )

Which means that we'd only return false if 1) the timestamp is not numeric or 2) the timestamp is negative or 0.

But, this doesn't handle the case where we attempt to unschedule a non-existent event.

I am attaching a patch that updates the documentation and adds a conditional that will return false if we attempt to unschedule a non-existent event.

Attachments (1)

39052.diff (2.7 KB) - added by ebinnion 8 years ago.
Return false if attempting to unschedule non-existent event

Download all attachments as: .zip

Change History (10)

@ebinnion
8 years ago

Return false if attempting to unschedule non-existent event

#1 @ebinnion
8 years ago

  • Keywords has-patch added

#2 @swissspidy
8 years ago

  • Focuses docs added
  • Keywords has-unit-tests added
  • Milestone changed from Awaiting Review to Future Release
  • Version trunk deleted

#3 @swissspidy
8 years ago

  • Milestone changed from Future Release to 4.8

This ticket was mentioned in Slack in #core by obenland. View the logs.


8 years ago

#5 @obenland
8 years ago

  • Milestone changed from 4.8 to Future Release

#6 @DrewAPicture
7 years ago

  • Focuses docs removed

#7 @peterwilsoncc
6 years ago

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

Fixed in [43050] as part of changes made for #21072.

#8 @netweb
6 years ago

  • Milestone changed from Future Release to 5.0

#9 @peterwilsoncc
6 years ago

  • Milestone changed from 5.0 to 5.1
Note: See TracTickets for help on using tickets.