#39052 closed defect (bug) (fixed)
Correct return value and documentation of wp_unschedule_event
Reported by: | 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)
Change History (10)
#2
@
8 years ago
- Focuses docs added
- Keywords has-unit-tests added
- Milestone changed from Awaiting Review to Future Release
- Version trunk deleted
Return false if attempting to unschedule non-existent event