Bug: TWiki::Func::redirectCgiQuery should never return
The documentation of
TWiki::Func::redirectCgiQuery says "never returns", which makes sense, since this function normally acts as some sort of error exit of a plugin.
However, the function does return, and plugin code following this call is executed, which may result in unexpected side effects.
Test case
Environment
--
JChristophFuchs - 13 Apr 2005
Impact and Available Solutions
Follow up
Fix record
In Func.pm, change the body of subroutine redirectCgiQuery from
return &TWiki::redirect( @_ );
to
&TWiki::redirect( @_ );
exit 0;
(Alternatively, state in the documentation of this routine that it does return
and the author of a plugin has to exit the script if this appropriate)
Discussion
No; there are circumstances under which it
must return - for example, if the redirect is to be printed but then further processing that does not generate output done. The documentation is wrong, it should state that the function returns but that the caller should not print anything else before exiting if an HTTP redirect is required.
--
CrawfordCurrie - 13 Apr 2005