0

I have a register form, when user sign up, it will redirect him to his page. All work fine in firefox and chrome, but in internet explorer. It looks like after the user information is saved, the session went off and it won't redirect the user to his page.

How can I fix this issue on IE?

$user = $this->_helper->model('Users')->createRow($signupForm->getValues());   
        if ($user->save())
        {               
            Zend_Session::rememberMe(186400 * 14);
            Zend_Auth::getInstance()->getStorage()->write($user);
            $user->sendSignUpEmail();
            $this->getHelper('redirector')->gotoRoute(array(), 'invite');
            return;
        }
Ya Fa Su
  • 160
  • 1
  • 4
  • 13
  • OP Dupe: http://stackoverflow.com/questions/14898669/zend-framwork-session-on-internet-explorer – ficuscr Feb 15 '13 at 17:50

2 Answers2

2

I'v got a similary problem to create session in iframe on IE before a redirection, and this works for me : Try to put in the Zend Action :

$response = $this->getResponse();
$response->setHeader('P3P', 'CP="CAO PSA OUR"', true); 

See What does header('P3P: CP="CAO PSA OUR"'); do?

Community
  • 1
  • 1
Ledadu
  • 111
  • 1
  • 4
0

You seems to keep posting variations of the same question. There's nothing in your code which should work differently on different browsers. You need to debug this to see how far IE is getting, that will help you identify the root cause of the problem.

So, do some debugging to try and answer these questions:

  • Does $user->save() return true? (i.e. does IE go into the if statement)
  • If it does go into the if, what is in $user? Try var_dump($user);exit; inside the if to see what you get
  • Does $user->sendSignUpEmail(); get called?
  • If it gets to the redirect part, what headers are being sent? (You should be able to check this using IE's developer tools)

If you are testing in IE on a different machine to the one with browsers that are working, also check the system clock, as incorrect date/time can cause sessions to be expired immediately.

Tim Fountain
  • 33,093
  • 5
  • 41
  • 69
  • I test a lot, yes it does go into the IF statement, the email is been send, but the session doesn't store that's why it won't redirect the user to the invite page. – Ya Fa Su Feb 08 '13 at 16:52
  • If I put the $user->save() after the session, it works, but it saved 3 times the same data and send 3 times the same emails. – Ya Fa Su Feb 08 '13 at 16:54
  • What class is `$user`, what does the `sendSignupEmail()` function look like? – Tim Fountain Feb 08 '13 at 16:56
  • The $user is only storing variable of the signup form that will be save into database. and send email function is a normal function to send email. – Ya Fa Su Feb 08 '13 at 16:59
  • it does save into database, but the session won't store after the user is saved. – Ya Fa Su Feb 08 '13 at 17:00
  • And only Internet explorer that cause that problem, not problems on others browsers. – Ya Fa Su Feb 08 '13 at 17:01
  • If the code runs 3 times, something outside of the code you've posted is causing that. There's no way for us to diagnose what's causing that from what you've posted. As for the main problem, my next move would probably be to clear out all sessions, submit the form in IE and see if a session is created with data in it (even if the browser itself doesn't have the session). – Tim Fountain Feb 08 '13 at 17:28
  • outside of that function had nothing. Look like after the user is saved, the sessions and redirect doesn't work, but the send email works. – Ya Fa Su Feb 08 '13 at 20:19