thetuningspoon Posted September 30, 2014 Share Posted September 30, 2014 Hi all,I'm setting a PW session variable in a module for an error message to output later in my template. The message is not appearing in my template, and I've narrowed it down to the fact that I am doing a $session->redirect("./") to reload the page after setting the value using $session->error = "my error message". If I use the php $_SESSION superglobal or if I remove the redirect, it works fine. But PW's $session should persist after a redirect, so I'm not sure what's going on here. EDIT: By the way, I'm using 2.5. Also, just realized that I'm getting this warning message: Warning: Invalid argument supplied for foreach() in /wire/core/Session.php on line 79 1 Link to comment Share on other sites More sharing options...
kongondo Posted September 30, 2014 Share Posted September 30, 2014 Always nice to see some code.... Link to comment Share on other sites More sharing options...
thetuningspoon Posted October 1, 2014 Author Share Posted October 1, 2014 Sorry, but I don't think the specific code would be helpful in this case. It's spread out, and the part that has to do the actual issue is what I've explained above. If it's not something apparent to anyone, I'll keep hacking away at it or settle for using $_SESSION. Link to comment Share on other sites More sharing options...
adrian Posted October 1, 2014 Share Posted October 1, 2014 I have had some similar issue and hacked around them also. Never really tried to figure out the root cause or come up with something that was repeatable enough to report. Link to comment Share on other sites More sharing options...
bramwolf Posted April 12, 2016 Share Posted April 12, 2016 Hi Guys, I think I finally solved this Or at least, I solved it for my case. The problem I had with this was that I used a form which submitted the page to a "www." variant of the page while all other standard pages where rendered without the "www.". By changing this in the config.php file I was able to keep all session variables and cookies (which previously also got dropped) $config->httpHosts = array( 'processwire.com', // our primary hostname 'www.processwire.com', // alternate hostname 'dev.processwire.com', // staging server 'localhost:8888' // MAMP local dev server ); I changed the one first to a www. variant, and the second one to a non-www. variant. in /site/config.php I hope this helps someone in the future! Bram 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now