redirect problems

Hi, I'm studying the response->redirect; and I encounter 2 strange results:

  1. validation - after redirection, seem like it's going to validate one more time. For example I insert a row that contains unique value, after the redirection it throws me an error. This problem will not occur for forward.
  2. flash session message - similar to validation, a flash message will output twice, and doesn't happen when using forward.

Have any of you encounter this problem?


return $this->response->redirect();

Instead of just



Thanks for the reply Pavel, however it doesn't work. The strange thing is the same code (haven't change anything, no return) magically produce different result:

  1. validation didn't work yesterday works today.
  2. flash session message still output twice even with return.

I think it need more complex code review to get a problem


they're the simplest code.

    public function testAction(){
        $systemUser           = new SystemUsers();
        $systemUser->username = 'un1'; // this column is unique
            foreach($systemUser->getMessages() as $message){
                $this->flash->error((string) $message);
            return $this->forward('test/success');

note: apparently the same action (testAction) is executed twice (it happens that it executed four times).