Question

I am working on a purchase system in my assignment and trying to solve the problem by using a session to store data in the process.

Although I'm experiencing a problem in Mozilla Firefox, which cannot for some reason work with the session I have created. There's most likely no doubt that I must have made some kind of mistake.

The process is as follows:

User fills form -> Clicks submit -> [Validation process] -> User reviews confirm page

Here is the relevant code from the controller:

public function indexAction() {
    $this->gatewayForm = new Payment_Form_Gateway;
    $save = $this->validate();

    $this->view->gatewayForm = $save['form'];
    $this->view->alert = $save['alert'];
}

public function validate() {
    # get form
    $form = $this->gatewayForm;
    if ($this->_request->isPost()) {
        # get params            
        $data = $this->_request->getPost();

        # check validate form
        if ($form->isValid($data)) {
            $session = new Zend_Session_Namespace('formData'); // name space creation
            $session->data = $data;
            $this->_helper->redirector('confirm', 'gateway', 'payment');
        } else {
            $alert = array('Pay failed');
        }
    $form->populate($data); 
    }
    return array('form' => $form, 'alert' => empty($alert) ? null : $alert );
}

public function confirmAction() {
    $this->_helper->viewRenderer->setNoRender(true); // disable std. view

    $session = new Zend_Session_Namespace('formData');
    $data = $session->data;             
    if(isset($data)) {
        $this->_helper->viewRenderer->setNoRender(false);
    } else {
        $this->_helper->redirector('index', 'gateway', 'payment');
    }
}

Things go wrong in the confirmAction in Firefox, the session namespace seems to be empty? Although this does not occur in Safari, Chrome, IE etc.

Thanks in advance.

Était-ce utile?

La solution

I reinstalled Firefox and removed config and cache files which did the magic. Problems solved!

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top