[wp-trac] [WordPress Trac] #5063: Potential type mismatch in post
cron hooks
WordPress Trac
wp-trac at lists.automattic.com
Mon Sep 24 03:17:07 GMT 2007
#5063: Potential type mismatch in post cron hooks
------------------------+---------------------------------------------------
Reporter: tellyworth | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.5
Component: General | Version:
Severity: normal | Keywords:
------------------------+---------------------------------------------------
The wp cron functions are very picky about argument types. For example,
if I do this:
{{{
$post_id = '123';
wp_schedule_single_event($time, 'foo', array($post_id));
wp_clear_scheduled_hook('foo', (int)$post_id);
}}}
..the hook won't get cleared as expected, because the type of the post_id
argument doesn't match (string vs int) even though its value is the same.
That's an easy mistake to make: in wp-includes/post.php, post ID's are
passed around that are variously strings or ints at different places in
the code. I'm not aware of any code that currently breaks, but it's a bug
waiting to happen.
To add to the confusion, Wordpress and Wordpress-mu store cron hooks with
different post ID types: Wordpress uses a string, Wordpress-mu uses an
int.
I'm not sure what the solution is, but it's probably worth noting
somewhere.
--
Ticket URL: <http://trac.wordpress.org/ticket/5063>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list