[wp-trac] [WordPress Trac] #36406: $network_wide is unreliable

WordPress Trac noreply at wordpress.org
Thu Dec 8 07:53:51 UTC 2016


#36406: $network_wide is unreliable
-------------------------------------------------+-------------------------
 Reporter:  mensmaximus                          |       Owner:
     Type:  defect (bug)                         |      Status:  reviewing
 Priority:  normal                               |   Milestone:  Future
Component:  Plugins                              |  Release
 Severity:  normal                               |     Version:  3.0
 Keywords:  has-patch needs-refresh needs-unit-  |  Resolution:
  tests                                          |     Focuses:  multisite
-------------------------------------------------+-------------------------
Changes (by swissspidy):

 * keywords:  has-patch => has-patch needs-refresh needs-unit-tests
 * severity:  major => normal


Comment:

 > Now as 4.7 is launched I would really like to see my patch or any other
 reliable solution to make it into 4.7.1.

 4.7.1 is specifically for regressions introduced in 4.7. Tickets like this
 one would get into a major release. No agreement could be reached for 4.7,
 that's why it was pushed back.

 > Still I do not understand what you are saying @jeremyfelt. My solution
 does not produce any fatal errors. My patch just fixes the missing
 $network_wide parameter. This is neither an enhancement nor a new feature.
 This is a bug fix.

 Nobody said your solution would produce any fatal errors, but that the
 patch ''works around'' the handling of fatal errors. Quote:

 > I'm not yet sure that working around the generation of a fatal error is
 the proper way to handle this.

 A quick note on the patch:

 * Patches should ideally be made from the root directory of the develop
 repository, so that the path reads like `src/wp-admin/plugins.php`, not
 `.mensmaximus.com/htdocs/wp-admin/plugins.php` or `plugins.` like in the
 latest patch. Otherwise the patch cannot be applied easily.
 * `$_REQUEST[ 'network_wide' ]` is not being sanitized. Since you only
 want a boolean value, that line could be simply changed to ` do_action(
 "activate_{$plugin}", isset( $_REQUEST['network_wide'] ) );`

 Further:

 * The `activate_plugin` hook really needs to be fixed. At one point the
 `$network_wide` argument passed and at another point it is not — without
 any documentation about it.
 * Sharing the same concern as Felix:

 > What we need to think about is whether the `is_network_admin()` check
 will be reliable enough to know that we're network-activating the plugin.
 I think it is in this case - but maybe we can find a more accurate
 solution.

 Adding `needs-unit-tests` to see if we can add unit tests for this. Not
 sure how testable the code is though.

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


More information about the wp-trac mailing list