[wp-trac] [WordPress Trac] #37731: Infinite loop in _wp_json_sanity_check() during plugin install

WordPress Trac noreply at wordpress.org
Tue Aug 23 20:34:13 UTC 2016


#37731: Infinite loop in _wp_json_sanity_check() during plugin install
-------------------------------------+-----------------------------
 Reporter:  maestrosite              |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  4.6.1
Component:  Plugins                  |     Version:  4.6
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  administration
-------------------------------------+-----------------------------

Comment (by gitlost):

 This is caused by adding as `'upgrader_process_complete'` actions various
 functions that don't expect to be called with the arguments it supplies,
 in this case `wp_update_plugins()`, which is given a `Plugin_Upgrader`
 object as its first argument (`$extra_stats`), and as the
 `Plugin_Upgrader` object has a reference to a `WP_Ajax_Upgrader_Skin`
 object which has a reference to a `Language_Pack_Upgrader` object which
 has a reference to the same `WP_Ajax_Upgrader_Skin` object...

 A way around it would be to use shims that accept the
 `'upgrader_process_complete'` arguments and then call the original
 functions with the right arguments. I'll upload a demo patch
 (incorporating "37731.4.patch" also) that adds shims for the 3 main
 culprits `wp_version_check()`, `wp_update_plugins` and
 `wp_update_themes()`.

 There's 2 others `wp_clean_plugins_cache()` and `wp_clean_themes_cache()`
 that could properly use shims but as they expect booleans it's not such a
 big deal.

 The remaining function `async_upgrade()` in `Language_Pack_Upgrader` has
 recursion avoidance built in.

 The patch is against 4.6 but also applies "hunk-successfully" against
 trunk.

 A way to reproduce the bug is to switch languages to eg French and then
 install an old version of a plugin eg bbPress and then update it.

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


More information about the wp-trac mailing list