Make WordPress Core

Opened 7 years ago

Closed 6 years ago

Last modified 22 months ago

#38462 closed task (blessed) (fixed)

Fix identical hooks with differing parameters

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: 4.9 Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: docs Cc:


Two recent instances where a hook that is triggered in multiple places in core has ended up having differing parameters:

It would be ideal to have unit test coverage which scans core's PHP files for all instances of do_action and apply_filters, filters hooks that occur multiple times, and then verifies that every instance of the hook accepts the same number of parameters.

Change History (16)

#1 @jdgrimes
7 years ago

The docs parser could probably do this easily, since it already scans for all of the hooks anyway. Maybe there is a way to integrate it into the tests process, but just to scan for the hooks?

#3 @johnbillion
7 years ago

Thanks for that @keesiemeijer! Some of the inconsistencies there are a complete mess.

#4 @keesiemeijer
7 years ago

Version 0, edited 7 years ago by keesiemeijer (next)

#5 @keesiemeijer
7 years ago

I've created a ticket for the concatenated dynamic hooks here: #39148

#6 @johnbillion
7 years ago

#40636 was marked as a duplicate.

#7 @johnbillion
6 years ago

  • Component changed from Plugins to General
  • Focuses docs added
  • Keywords needs-patch added; needs-unit-tests removed
  • Milestone changed from Awaiting Review to Future Release
  • Summary changed from Unit test to detect identical hooks with differing parameters to Fix identical hooks with differing parameters
  • Type changed from feature request to task (blessed)

I think we can drop the idea of unit testing this for now, and concentrate on fixing the differing parameters.

#8 @johnbillion
6 years ago

In 41215:

Docs: Fix various filter documentation.

See #38462, #41017

#9 @johnbillion
6 years ago

In 41216:

Docs: Add a missing docblock for the the_content_rss filter.

See #38462, #41017

#10 @johnbillion
6 years ago

In 41217:

General: Add missing parameters to instances of the the_permalink filter.

This ensures every instance of this filter receives the same parameters.

Props keesiemeijer for identifying the issue

See #38462

#11 @johnbillion
6 years ago

In 41219:

General: Fix various instances of incorrect filter docs and incorrect filter and action parameters.

Props keesiemeijer for identifying the issues

See #38462

#12 @johnbillion
6 years ago

In 41220:

General: Fix a typo introduced in [41219].

See #38462

#13 @johnbillion
6 years ago

  • Milestone changed from Future Release to 4.9

#14 @johnbillion
6 years ago

In 41221:

General: Fix more instances of inconsistent parameters passed to various filters, plus fix some filter docs.

See #38462, #41017

#15 @johnbillion
6 years ago

  • Keywords needs-patch removed
  • Resolution set to fixed
  • Status changed from new to closed

Thanks again for those scans, @keesiemeijer . I've fixed all of the issues. The remaining issue is in #38057.

#16 @SergeyBiryukov
22 months ago

#40757 was marked as a duplicate.

Note: See TracTickets for help on using tickets.