[wp-trac] [WordPress Trac] #39052: Correct return value and documentation of wp_unschedule_event
WordPress Trac
noreply at wordpress.org
Sun Dec 4 16:50:00 UTC 2016
#39052: Correct return value and documentation of wp_unschedule_event
--------------------------+-----------------------------
Reporter: ebinnion | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cron API | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39052>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list