[wp-trac] [WordPress Trac] #10468: wp_clear_scheduled_hook does not work when including an $args parameter
WordPress Trac
wp-trac at lists.automattic.com
Thu Jul 23 03:53:10 UTC 2009
#10468: wp_clear_scheduled_hook does not work when including an $args parameter
--------------------------+-------------------------------------------------
Reporter: johnbillion | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Unassigned
Component: Cron | Version: 2.8.1
Severity: normal | Keywords: cron, wp-cron, wp_clear_scheduled_hook
--------------------------+-------------------------------------------------
The value for $args that gets passed from `wp_clear_scheduled_hook` to
`wp_unschedule_event` gets changed and therefore nothing will get
unscheduled as no jobs will have that argument.
The problem is that the value of the $args parameter is detected using
`array_slice( func_get_args(), 1 )` and this actually places the value of
$args inside an array with one element with the value of $args.
The value of $args passed by `wp_clear_scheduled_hook('my_hook','hello')`
to `wp_unschedule_event` will then look like this:
{{{
array
(
[0] => hello
)
}}}
instead of this:
{{{
hello
}}}
----
The function `wp_clear_scheduled_hook` is used with the $args parameter in
core in three places:
1. Inside `wp_delete_post` to clear any job which might try to publish a
future post which has been deleted.
2. Inside `check_and_publish_future_post` to clear any job which might
try to republish a future post which has been published.
3. Inside `_transition_post_status` to clear any job which might try to
publish a future post which has gone back to draft status.
So according to this bug, these three areas cannot be functioning as
expected, as they pass a value in the $args parameter to
`wp_clear_scheduled_hook`.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10468>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list