[wp-trac] [WordPress Trac] #39766: Plugin does not gracefully fail when editing active plugin causes fatal error

WordPress Trac noreply at wordpress.org
Sat Sep 23 20:31:55 UTC 2017


#39766: Plugin does not gracefully fail when editing active plugin causes fatal
error
-------------------------------------+-----------------------------
 Reporter:  ovann86                  |       Owner:  westonruter
     Type:  defect (bug)             |      Status:  reopened
 Priority:  high                     |   Milestone:  4.9
Component:  Plugins                  |     Version:  4.7.2
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  administration
-------------------------------------+-----------------------------
Changes (by jdgrimes):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 I started getting a huge number of failures in the unit tests for one of
 my plugins, and I was able to trace it back to [41560]. The use of
 `plugin_sandbox_scrape()` in `activate_plugin()` is the problem, in
 particular, the running of the `'plugins_loaded'` action. I am still
 investigating exactly what is going on there (it has to do with how the
 plugin is activated before the tests run), but after reviewing this change
 I think that in general it needs a lot more testing with various plugins.
 Running these actions immediately after activation is unexpected by
 plugins and may cause issues. Also, some of the functions hooked to these
 actions by plugins may expect other actions to run between them, and will
 have problems. While running these common actions seems like a reasonable
 idea, I think that it needs a lot more thought, and is probably not
 feasible. It would be better to trigger a remote request that would run
 all of the usual code, rather than just simulating a few actions. A
 request for the plugins screen would be ideal, since even if things break
 somewhere else, as long as the user can access the plugins screen they can
 still deactivate the plugin if needed. But regardless, I think that the
 part of the commit running those actions may need to be reverted for now,
 until a better solution is found.

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


More information about the wp-trac mailing list