Session variables missing when redirecting from extension

Session variables missing when redirecting from extension

Thursday 12 October 2006 2:28:26 pm - 4 replies

Author Message

Kristof Coomans

Friday 13 October 2006 12:37:30 am

Hello Luis

Did you try this?

// Method 6
$http =& eZHTTPTool::instance();
$http->setSessionVariable( 'stuff', $stuff );
return $Module->redirectTo( '/path/to/somewhere' );

I advice you to upgrade to a more recent release of the 3.6 branch, the one you are using is really old.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Luis Cruz

Friday 13 October 2006 6:36:42 am

@Kristof

Nope, that didn't work either. The other methods redirected to the second extension, but this one didn't even do that.

Thanks though; I'll look into the code for the module redirect and see if there is something else in or around it that might be useful to try.

Cheers.

Claudia Kosny

Friday 13 October 2006 1:42:11 pm

Hi Luis

I jus tried Kristofs suggestion on EZ 3.8.4 and it works fine. The module redirects the the other extension and this extension can see the session parameters that I set in the first extension. Although this will not help you much with your current problem it might be an incentive to upgrade ;-)

Good luck

Claudia

Luis Cruz

Wednesday 01 November 2006 10:20:22 am

Upgrading to the latest version of eZ turned out to not be the solution to my problem (now on 3.6.11). I was misunderstanding how eZ was handling session information; this helped me clear up one issue. However, my primary issue remains. Here is the flow step by step.

1. End up on page /foo. This page contains a form.

2. Plug in values into the form and submit.

3. The form submits to the same page, /foo.

4. /foo detects that the form has been submitted and calls function validate()

5. Based on the form data, validate() sets certain session variables.

6. validate() finally does a header("Location: /bar");

7. Arriving at /bar shows that the session variables have vanished.

I've put debug statements nearly everywhere. In between steps 5 & 6, I dump out the entire $_SESSION variable to a log file. It shows that my variables are set. However, dumping $_SESSION out on step 7 shows that the variables set in the validate() function on /foo have disappeared.

I've also tried placing eZSessionStop() calls in various places (e.g., after setting my variables in validate() ) to flush things out, but that has not brought success either. Very stumped at this point.

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.