Skip to content

Move RedirectFinisher to always execute last using "finally" key#1347

Merged
mschwemer merged 1 commit intoin2code-de:typo3-v12from
thomasrawiel:finishers
Feb 25, 2026
Merged

Move RedirectFinisher to always execute last using "finally" key#1347
mschwemer merged 1 commit intoin2code-de:typo3-v12from
thomasrawiel:finishers

Conversation

@thomasrawiel
Copy link
Contributor

Problem:

  • Finishers are sorted by numeric keys, which can cause custom finishers to be skipped.
  • RedirectFinisher throws a PropagateResponseException, halting execution of any finishers with higher keys.

Solution:

  • Introduce a "finally" key in the finisher configuration.
  • If a finisher is defined under "finally", it is moved to the highest numeric key.
  • Preserves the full finisher structure and avoids duplicates if the class is already present.
  • Ensures RedirectFinisher (or any finally finisher) always runs last, without losing custom finishers.

Example:
plugin.tx_powermail.settings.setup.finishers {
10.class = In2code\Powermail\Finisher\SaveToAnyTableFinisher
20.class = In2code\Powermail\Finisher\SendParametersFinisher
finally.class = In2code\Powermail\Finisher\RedirectFinisher
1000.class = Vendor\Ext\Finisher\CustomFinisher
}

This guarantees predictable execution order and maintains backward compatibility with manual configurations.

resolves #1346

@mschwemer
Copy link
Collaborator

Hi

Thanks for this idea an PR. Can you fix indendation issues, I commented on.

Then I am happy to merge your PR.

Problem:
- Finishers are sorted by numeric keys, which can cause custom finishers to be skipped.
- RedirectFinisher throws a PropagateResponseException, halting execution of any finishers with higher keys.

Solution:
- Introduce a "finally" key in the finisher configuration.
- If a finisher is defined under "finally", it is moved to the highest numeric key.
- Preserves the full finisher structure and avoids duplicates if the class is already present.
- Ensures RedirectFinisher (or any finally finisher) always runs last, without losing custom finishers.

Example:
plugin.tx_powermail.settings.setup.finishers {
    10.class = In2code\Powermail\Finisher\SaveToAnyTableFinisher
    20.class = In2code\Powermail\Finisher\SendParametersFinisher
    finally.class = In2code\Powermail\Finisher\RedirectFinisher
    1000.class = Vendor\Ext\Finisher\CustomFinisher
}

This guarantees predictable execution order and maintains backward compatibility with manual configurations.

resolves in2code-de#1346
@mschwemer mschwemer merged commit 1ebb27f into in2code-de:typo3-v12 Feb 25, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants