Zend Framwork Session on Internet Explorer [duplicate]

自闭症网瘾萝莉.ら 提交于 2019-12-11 18:28:27

问题


Still couldn't make it works after post this link: Zend framework session lost

I have this Sign up form that allow users to register and redirect them right away to their pages. All work great on every browsers except INTERNET EXPLORER.

I have tried different ways, but still can't make it to work. After the user is saved to database the session won't store. But if I take out the save of the user, the session and cookies can be store.

Here's the code:

public function signUpAction()
{
    $signupForm = new Application_Form_UserSignUp();
    if ($this->getRequest()->isPost())
    {

        if ($signupForm->isValid($this->getRequest()->getParams()))
        {
            $user = $this->_helper->model('Users')->createRow($signupForm->getValues());
            if ($user->save())
            {
                //Set email into cookies for displaying into login inputfield
                setcookie('display_email', $this->getRequest()->getParam('email'), time() + 3600*24*30, '/'); <-- not working
                Zend_Session::rememberMe(186400 * 14); <-- not working
                Zend_Auth::getInstance()->getStorage()->write($user); <-- not working

                $user->sendSignUpEmail(); <-- i'm receiving this email
                $this->getHelper('redirector')->gotoRoute(array(), 'invite');                   
                return;
            }
        }
    }
    $this->view->signupForm = $signupForm;

Here's another way I'm doing but still doesn't working on IE:

public function signUpAction()
{

    $users = new Application_Model_DbTable_Users();
    $signupForm = new Application_Form_UserSignUp();
    if ($this->getRequest()->isPost())
    {
        $firstname = $this->getRequest()->getParam('first_name');
        $lastname = $this->getRequest()->getParam('last_name');
        $email = $this->getRequest()->getParam('email');

        if ($signupForm->isValid($this->getRequest()->getParams()))
        {
            $user = $this->_helper->model('Users')->createRow($signupForm->getValues());

            $user = array('email' => $email, 'first_name' => $firstname, 'last_name' => $last_name);
            $users->insert($user);
            Zend_Session::rememberMe(186400 * 14);
            Zend_Auth::getInstance()->getStorage()->write($user);
            $this->_redirect('invite');
        }
    }
    $this->view->signupForm = $signupForm;

回答1:


Try using session_write_close before calling the redirect. Or I think Zend has an equivalent, see: Zend_Session::writeclose

Only other thing that comes to mind (with IE being the only browser giving you trouble) is P3P policy. Look at Talha's post here: Zend Sessions problem with IE8



来源:https://stackoverflow.com/questions/14898669/zend-framwork-session-on-internet-explorer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!