Make WordPress Core

Opened 16 years ago

Closed 11 years ago

#14789 closed enhancement (maybelater)

Inconsistency in 'all' hook invocation

Reported by: hakre Owned by:
Priority: normal Milestone:
Component: Plugins Version: 3.0
Severity: normal Keywords: has-patch needs-refresh dev-feedback
Cc: Focuses:

Description

The 'all' hook (catchall hook for any hook name) is getting inconsistently called depending on how the concrete hook is being invoked: by apply_filters, apply_filters_ref_array, do_action or do_action_ref_array.

In the simple cases (apply_filters, do_action), the hook will get all parameters passed, in the ..._ref_array cases, the hook will get only two parameters passed in which the first parameter is the name of the hook (a.k.a. tag) and the second parameter is an array of all other parameters.

Every 'all' hook-function-callbacks should be called in the same way regardless whether which of the four invocation functions have been used on that pointcut.

Additionally all four routines share a lot of the same code which could benefit of a refactoring.

Attachments (7)

14789.patch (701 bytes ) - added by hakre 16 years ago.
14789.2.patch (6.4 KB ) - added by hakre 16 years ago.
Basically filters and actions are hooks and the same.
14789.3.patch (6.7 KB ) - added by hakre 16 years ago.
Remove of some redundant code.
14789.4.patch (15.4 KB ) - added by hakre 16 years ago.
Touched other functions as well.
14789.5.patch (15.4 KB ) - added by hakre 16 years ago.
Corrected some whitespace issues on empty lines.
14789.6.patch (705 bytes ) - added by hakre 15 years ago.
Vertical rythm fixed.
14789.7.patch (1.4 KB ) - added by hakre 15 years ago.
no need to shift plus type hints

Download all attachments as: .zip

Change History (26)

@hakre
16 years ago

@hakre
16 years ago

Basically filters and actions are hooks and the same.

@hakre
16 years ago

Remove of some redundant code.

#2 @hakre
16 years ago

  • Keywords dev-feedback added

#3 @hakre
16 years ago

  • Summary Inconsitency in 'all' hook invocationInconsistency in 'all' hook invocation

@hakre
16 years ago

Touched other functions as well.

@hakre
16 years ago

Corrected some whitespace issues on empty lines.

#4 @hakre
16 years ago

Related: #10535

#5 @hakre
16 years ago

Second Parameter Definition in Function Header of do_action() might be bogus: #14881

#6 @hakre
16 years ago

First patch is the important one: http://core.trac.wordpress.org/attachment/ticket/14789/14789.patch

The other patches aren't the actual bugfix, they should go into a ticket on it's own.

#7 @westi
16 years ago

  • Milestone Awaiting Review
  • Resolutionmaybelater
  • Status newclosed

First patch might be ok.

Needs testing and validating with the unit test suite.

#8 @hakre
15 years ago

  • Keywords dev-feedback removed
  • Resolution maybelater
  • Status closedreopened

14789.patch had been extensively tested, unit test suite run same with and w/o patch. If you have some specific test in mind, let me know.

Reference: #16661

#9 follow-up: @scribu
15 years ago

  • Owner set to scribu
  • Status reopenedreviewing

The inconsistent spacing in 14789.patch makes it harder to read. No, really.

#10 @scribu
15 years ago

  • Owner scribu removed

#11 in reply to: ↑ 9 @hakre
15 years ago

Replying to scribu:

The inconsistent spacing in 14789.patch makes it harder to read. No, really.

That's right, the vertical rythm is broken. Will update it.

@hakre
15 years ago

Vertical rythm fixed.

@hakre
15 years ago

no need to shift plus type hints

#12 @ocean90
15 years ago

  • MilestoneAwaiting Review

#13 follow-up: @c3mdigital
13 years ago

  • Keywords close 2nd-opinion added

#14 in reply to: ↑ 13 ; follow-up: @hakre
13 years ago

Replying to c3mdigital:

Can you please justify your close suggestion?

#15 in reply to: ↑ 14 ; follow-up: @c3mdigital
13 years ago

Replying to hakre:

Replying to c3mdigital:

Can you please justify your close suggestion?

To me this seems more like refactoring than a bug and hasn't had any traction in 3 years. I added 2nd opinion so someone else could give a suggestion on whether or not this ticket should stay open. I really don't see a bug here.

#16 in reply to: ↑ 15 @hakre
13 years ago

  • Keywords close removed

Replying to c3mdigital:

Replying to hakre:

Replying to c3mdigital:

Can you please justify your close suggestion?

To me this seems more like refactoring

No, this is not refactoring. Refactoring would mean that behavior is not changed even the code changed. Here the behavior is changed with this patch. Which by definition is not refactoring.

than a bug

The term bug is not really precise, as it's not refactoring can you please explain what you mean by that?

Last edited 13 years ago by hakre (previous) (diff)

#17 @nacin
13 years ago

  • Component GeneralPlugins

#18 @chriscct7
11 years ago

  • Keywords needs-refresh dev-feedback added; 2nd-opinion removed
  • Type defect (bug)enhancement
  • Version 3.0.13.0

#19 @DrewAPicture
11 years ago

  • Milestone Awaiting Review
  • Resolutionmaybelater
  • Status reviewingclosed

No movement here in 2 years. Still need a refreshed patch and refreshed unit tests to move forward. Closing as maybelater.

Note: See TracTickets for help on using tickets.