[TYPO3-mvc] T3 6.2 ActionController: flashMessage after redirect issue

Helmut Hummel helmut.hummel at typo3.org
Thu Aug 21 14:14:22 CEST 2014


Hi Till!

On 21.08.14 03:57, g4-lisz at tonarchiv.ch wrote:

> there is some issue in a extension we try to migrate from 4.6 to 6.2:
>
> In the controller class there is an editAction, which displays an edit form.
> There is also an updateAction, which is called when the form has been
> submittet.
>
> After processing form data, the updateAction redirects to editAction again.
> Before doing so, it adds a message using
>      $this->addFlashMessage('Saved');
>
> This message is not shown anymore. This was working with T3. 4.6.

Nothing relevant changed in this area.

> What I am doing wrong? How can I add a flash message in an update action?

Please be aware that if your controller uses the default flash message 
queue (which is the default ^^) then all other plugins that render flash 
messages will empty this queue (after rendering).

This means if you have another plugin on the same page (e.g. News), the 
flash message will be added, a redirect header will be set, but the 
rendering continues which means another plugin (e.g. News) will be 
rendered, but the user will never see the result as after the rendering 
the redirect happens (because of the redirect HTTP header).

This is how flash messages are misteriously lost...

If you want dedicated queues for each plugin set the following TS:

config.tx_extbase.legacy.enableLegacyFlashMessageHandling = 0

Kind regards,
Helmut

-- 
Helmut Hummel
Release Manager TYPO3 6.0
TYPO3 Core Developer, TYPO3 Security Team Member

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the TYPO3-project-typo3v4mvc mailing list