[wp-trac] [WordPress Trac] #39338: class-wp-hook.php - apply_filters() infinite loop

WordPress Trac noreply at wordpress.org
Thu Jan 26 11:19:37 UTC 2017


#39338: class-wp-hook.php - apply_filters() infinite loop
-------------------------------------------+--------------------
 Reporter:  frettled                       |       Owner:
     Type:  defect (bug)                   |      Status:  new
 Priority:  normal                         |   Milestone:  4.7.2
Component:  Plugins                        |     Version:  4.7
 Severity:  normal                         |  Resolution:
 Keywords:  reporter-feedback needs-patch  |     Focuses:
-------------------------------------------+--------------------

Comment (by frettled):

 Here is another incident with an infinite loop, from a different site.

 This site runs WP 4.7.1.

 A plugin (wordpress-backup-to-dropbox) gets interrupted by PHP's maximum
 execution time limit, and class-wp-hook.php goes bananas, just like
 plugin.php used to do in 4.6.1 (which, BTW, has had multiple incidents for
 multiple sites since the last time, but because the code has been fixed in
 4.7, I haven't bothered reporting it as 4.6 won't be fixed, right?)

 The plugin version is 4.5.3, the most recent is plugin version 4.7. Plugin
 version 4.7 introduces '''no code changes''', so that's irrelevant.

 <pre>
 PHP Fatal error: Maximum execution time of 30 seconds exceeded in
 [...]/wp-content/plugins/wordpress-backup-to-
 dropbox/Classes/Processed/Files.php on line 40, referer: http://[...]/wp-
 cron.php?doing_wp_cron=[...]
 PHP Warning:  array_keys() expects parameter 1 to be array, integer given
 in [...]/wp-includes/class-wp-hook.php on line 283, referer: http
 ://[...]/wp-cron.php?doing_wp_cron=[...]
 PHP Warning:  current() expects parameter 1 to be array, null given in
 [...]/wp-includes/class-wp-hook.php on line 287, referer: http://[...]/wp-
 cron.php?doing_wp_cron=[...]
 PHP Warning:  Invalid argument supplied for foreach() in  [...]/wp-
 includes/class-wp-hook.php on line 289, referer: http://[...]/wp-
 cron.php?doing_wp_cron=[...]
 PHP Warning:  next() expects parameter 1 to be array, null given in
 [...]/wp-includes/class-wp-hook.php on line 303, referer: http://[...]/wp-
 cron.php?doing_wp_cron=[...]
 PHP Warning:  current() expects parameter 1 to be array, null given in
 [...]/wp-includes/class-wp-hook.php on line 287, referer: http://[...]/wp-
 cron.php?doing_wp_cron=[...]
 PHP Warning:  Invalid argument supplied for foreach() in  [...]/wp-
 includes/class-wp-hook.php on line 289, referer: http://[...]/wp-
 cron.php?doing_wp_cron=[...]
 PHP Warning:  next() expects parameter 1 to be array, null given in
 [...]/wp-includes/class-wp-hook.php on line 303, referer: http://[...]/wp-
 cron.php?doing_wp_cron=[...]
 </pre>

 As previously noted by me, this is testable and reproducible.

 An alternative for reproducing is to make a dummy plugin that simply
 executes for longer than the regular max execution time, and then gets
 terminated by PHP.

 But better yet, ensure that no loops depend on mistaken assumptions about
 guaranteed nice shutdown of plugins. Plugins may crash due to external
 circumstances. This particular "external" circumstance is PHP's execution
 time cap, but when running PHP under suphp or FastCGI or uWSGI or
 something else, there may be other things going on.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39338#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list