#33475 closed defect (bug) (fixed)
Ensure timestamp is integer when scheduling single events
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 2.1 |
Component: | Cron API | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Validate the timestamp passed to wp_schedule_single_event
to ensure it is an integer and occurs in the future.
Related: #33423
Attachments (4)
Change History (14)
#2
@
9 years ago
- Keywords has-patch added; needs-patch removed
- Version set to 2.1
Thanks for the patch @utkarshpatel.
I am in two minds as to whether it is worth a doing_it_wrong call if the timestamp is not numeric. Reviewers, any thoughts?
#3
@
9 years ago
@utkarshpatel for 33475.patch I'd probably have kept the two checks distinct from each other (valid timestamps; and already scheduled) for the simple desire of readability (Also, please always add a comment after you upload a patch, Trac doesn't send out notifications when you only upload a patch)
I don't really see a huge benefit for a _doing_it_wrong()
here, developers will find out that their events are not running pretty quickly while testing (I would hope), this just prevents the cron array filling with things that won't ever be executed.
#4
@
9 years ago
Hey Hulse,
As you pointed out comment and new conditionI have added new patch. Please check and let me know.
#5
@
9 years ago
33475.diff refreshes from project root
#6
@
9 years ago
Seems like other functions would benefit from the same check for consistency, see 33475.2.diff.
Existing in the past is also valid I believe, cron simply processes any events
<= time()
.I think the rule should be
is_numeric( $timestamp ) && $timestamp > 0