Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#40703 closed defect (bug) (fixed)

Adjust the `add_filter()` calls for `wp_maybe_update_*_counts()` in `ms-default-filters.php`

Reported by: flixos90's profile flixos90 Owned by: flixos90's profile flixos90
Milestone: 4.8 Priority: normal
Severity: normal Version: 4.8
Component: Networks and Sites Keywords: has-patch commit
Focuses: multisite Cc:


Now that wp_maybe_update_network_site_counts() and wp_maybe_update_network_user_counts() support a $network_id parameter, we should ensure that no parameter is passed to it when hooking it into a filter. For example, the make_*_blog hooks pass a site ID, which is currently passed to the hooked wp_maybe_update_network_site_counts() function, although its only parameter should be a network ID.

Attachments (2)

40703.diff (943 bytes) - added by flixos90 7 years ago.
40703.2.diff (1.0 KB) - added by flixos90 7 years ago.

Download all attachments as: .zip

Change History (7)

7 years ago

#1 @flixos90
7 years ago

  • Keywords has-patch added; needs-patch removed
  • Owner set to flixos90
  • Status changed from new to assigned

40703.diff sets the $accepted_args parameter of the add_filter() calls to 0, so that no parameters are passed to the functions.

#2 @jeremyfelt
7 years ago

  • Keywords commit added

Good catch, @flixos90. 40703.diff looks right.

7 years ago

#3 @flixos90
7 years ago

40703.2.diff also fixes the same for the wp_update_network_counts() function on the update_network_counts cron hook.

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.

7 years ago

#5 @flixos90
7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 40596:

Multisite: Fix filter hooks for the updating network count functions.

[40591] and [40593] introduced a $network_id parameter for wp_maybe_update_network_site_counts() and wp_maybe_update_network_user_counts(), as well as [40486] previously added it to wp_update_network_counts(). This changeset ensures the filter hooks in ms-default-filters.php do not pass any parameter to them that might conflict with their actual $network_id parameter, which caused unit test failures before.

Fixes #40703.

Note: See TracTickets for help on using tickets.