WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 9 months ago

#21072 reviewing enhancement

CRON often returns ambiguous values

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

Description

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 (2)

20172.diff (5.4 KB) - added by evansolomon 5 years ago.
0001-Refresh-of-evansolomon-s-patch-for-issue-20172.patch (9.6 KB) - added by jrf 23 months ago.
Refresh of the earlier patch.

Download all attachments as: .zip

Change History (9)

@evansolomon
5 years ago

#1 @SergeyBiryukov
5 years ago

  • Keywords has-patch added

#2 @ace_dent
4 years ago

  • Cc ace_dent added

#3 @nacin
4 years 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?

#4 @chriscct7
2 years ago

  • Keywords needs-refresh added

@jrf
23 months ago

Refresh of the earlier patch.

#5 @jrf
23 months ago

  • Keywords needs-refresh removed

I've refreshed @evansolomon's patch.

(and boyscouted inline control structures in the touched functions).

#6 @ericlewis
23 months ago

#31598 was marked as a duplicate.

#7 @swissspidy
9 months ago

  • Owner set to swissspidy
  • Status changed from new to reviewing
Note: See TracTickets for help on using tickets.