[TYPO3-core] RFC #12186: EM sends Location-header without exit

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Oct 12 10:11:10 CEST 2009


Steffen Kamper schrieb:
> Hi,
> 
> Martin Kutschker schrieb:
>> Ernesto Baschny [cron IT] schrieb:
>>> Steffen Kamper schrieb:
>>>> Hi,
>>>>
>>>> committed this nobrainer to trunk, rev 6140
>>>>
>>>> vg Steffen
>>> I haven't really looked at the patch, but doing an early exit() is not
>>> really a "no-brainer". It could be that the PHP script needs to execute
>>> "something" at the end of it, like saving the session, closing stuff or
>>> writing something to the DB.
>>
>> Yes, but that would be a very confusing way to code it. Writing a
>> redirect header is usually
>> followed by an exit(). It's much easier to read if the redirect is the
>> very last statement. If this
>> cannot be done in the program flow I think a comment is warranted that
>> explains why an exit() at
>> that point is not possible (and where it happens).
>>
> 
> yes. There is nothing done after so the exit is right. And Masi is
> right, doing redirect and stuff after it is wrong/bad coding.
> 
> @Georg - you're right with converting redirects using t3lib_div. This
> can be done in one patch for all remainings.

It is wrong / bad, but it happens in the FE for example. TYPO3 core
stores the user session at the end of your process. If you just do an
"exit()" in one of your plugins, you might disrupt the storage of any
new information you or other plugins added in your session: you have to
tell TYPO3 to store the session for you before doing the exit().

But I guess in the BE there are no such side effects, as only one module
runs at a time. Still attention should be taken when doing an early
exit(). This was just a reminder about it, because I guess some people
are not aware of that. Because of that I think it is not a no-brainer.

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list