Make WordPress Core

Opened 22 months ago

Last modified 2 months ago

#21072 new enhancement

CRON often returns ambiguous values

Reported by: evansolomon Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Cron API Keywords: has-patch
Focuses: Cc:


Many of the cron API functions return ambiguous values. For example, wp_cron() returns null (explicitly) when cron doesn't run, but it also returns null (implicitly) every other time. This can make debugging harder.

Whenever possible, I think it's valuable to return meaningful values. The attached patch does that.

Attachments (1)

20172.diff (5.4 KB) - added by evansolomon 22 months ago.

Download all attachments as: .zip

Change History (4)

evansolomon22 months ago

comment:1 SergeyBiryukov22 months ago

  • Keywords has-patch added

comment:2 ace_dent10 months ago

  • Cc ace_dent added

comment:3 nacin2 months ago

  • Milestone changed from Awaiting Review to Future Release

I think this is good. While there are technically return value changes, I'm not too concerned about the back compat.

wp_clear_scheduled_hook() probably just needs to return true (it got cleared) or false, versus an array. It's also possible we change how that function works in the future, #25773 gave us some trouble.

The wp_remote_post() call is non-blocking, so spawn_cron() should probably not have a return value, right? Thus wp_cron() shouldn't have a return value either. I know that was the original bug report — what about true? Is that sufficient?

Note: See TracTickets for help on using tickets.