The very last thing the redirect() method does is throw a sfStopException
that's why it goes all the way through try AND catch.

On Tue, Mar 30, 2010 at 12:14 PM, NOOVEO - Christophe Brun <c.b...@nooveo.fr
> wrote:

>  I want to catch some exceptions in my actions and to display nice and
> informative messages for my users.
>
> class utilisateursActions extends autoUtilisateursActions {
>     public function executeDelete(sfWebRequest $request) {
>        try {
>           // do stuff...
>           sfContext::getInstance()->getLogger()->err(__METHOD__." ligne
> ".__LINE__); // line 50
>           return $this->redirect('@avalidroute' <%...@avalidroute%27>);
>        }
>        catch(Exception $x) {
>           sfContext::getInstance()->getLogger()->err(__METHOD__." ligne
> ".__LINE__); // line 54
>           $this->getUser()->setFlash('error', 'KO');
>        }
>     }
> }
>
> Unfortunately, the flash and the log tells me that the code goes through
> 50, redirects to the required route, AND goes on to line 54 + flashes the
> error.
>
> I already knew that $action->redirect() has the side effect (very
> unfortunate as all side effects are IMHO) to break the standard flow of
> code, that's why you must return $action-redirect() instead.
> But what if return $obj->redirect() also breaks the flow ?
> Or am I missing some elephant hidden in my kitchen ?
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>
> To unsubscribe from this group, send email to symfony-users+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to