Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Session::set set on one page, missing on the next

Go to End

3 Posts   1514 Views


Community Member, 607 Posts

10 November 2009 at 3:11pm

Hi all

OK here's my process

1. Checkout form on a heavily modified ecommerce module user fills out form, whose action is set to controller processPayment method.

2. Among other things, this method does this ($data being the submitted form data):

Session::set('orderForm.'.$cart->ID, $data);

If I output this right after this call with Session::get('orderForm.'.$cart->ID);, all is fine and as expected.

3. User is redirected to 3rd party secure credit card processing. On success, they are sent back to another page where the response is handled by the processOrder controller method.

It is at this point where Session::get('orderForm.'.$cart->ID); returns nothing. Yes I have outputted $cart->ID to check that holds the correct value.

I have also outputted the entire $_SESSION and the item I set in 2. is not present.

Any ideas? What is the scope of these Session objects? Has the '.' after orderForm got anything to do with it?



Community Member, 607 Posts

10 November 2009 at 5:44pm

Stuff it. I used $_SESSION instead. It works.



Community Member, 97 Posts

25 February 2013 at 11:40pm

my colleague got the same problem and have to use _SESSION at the end.

does it mean there is problem with Session::set method??