Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session getFlashdata() is not removing the flash data #446

Closed
qury opened this issue Mar 13, 2017 · 4 comments
Closed

session getFlashdata() is not removing the flash data #446

qury opened this issue Mar 13, 2017 · 4 comments

Comments

@qury
Copy link
Contributor

qury commented Mar 13, 2017

Hi,
I ran into an issue with flash data.
When i use $session->setFlashdata(['item'=>'value']) the entries as preserved across multiple page loads.

I believe an unset method should be added to the getFlashdata method?

@lonnieezell
Copy link
Member

What session driver are you using? That should be handled in the main Session.php file, during the initVars() method.

@qury
Copy link
Contributor Author

qury commented Mar 20, 2017

I use CodeIgniter\Session\Handlers\FileHandler
Does it make a difference that i initiate the session in the index.php file with session_start()?

@lonnieezell
Copy link
Member

Yes, that definitely makes a difference. When you load/initialize the Session library for the first time, the session is automatically started. You don't need to do that. By starting the session manually at the start of the script you're not allowing CI to set the session driver up, which is used by PHP to handle sessions. So, CI can't provide the additional features like flash data. Remove that and I think you'll be fine.

@qury
Copy link
Contributor Author

qury commented Mar 28, 2017

OK, this works fine, i just had to experiment with it a little bit, and use the sessoion() convenience function.

@qury qury closed this as completed Mar 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants