[wp-trac] [WordPress Trac] #40161: Wrong documented or coded 'schedule_event' filter

WordPress Trac noreply at wordpress.org
Wed Mar 15 12:39:09 UTC 2017


#40161: Wrong documented or coded 'schedule_event' filter
--------------------------+-----------------------------
 Reporter:  esemlabel     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Cron API      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/cron.php#L41
 says that $event parameter should always be an object.

 But the following code allows to terminate script only when passing
 "false" values to filter ("", array(), null, 0 or false), whereas checking
 false as object will produce error.

 The documentation should be changed to force check isset( $event->hook )
 when using this filter, otherwise the filter should be changed to
 something like this

 {{{#!php
 <?php
 $event = apply_filters( 'schedule_event', $event->hook, $event );
 if ( ! $event->hook )
     return false;
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40161>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list