bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.61k forks source link

session is auto destroyed (auto logout) #5934

Closed dreamcoder8 closed 4 years ago

dreamcoder8 commented 4 years ago

Session is being destroyed automatically. This is mostly when user is being redirected back from Payment API (Paytm)

I have following configuration on config.php $config['sess_driver'] = 'files'; $config['sess_cookie_name'] = 'my_session'; $config['sess_expiration'] = 51840000; $config['sess_expire_on_close'] = FALSE; $config['sess_save_path'] = '../session/'; $config['sess_match_ip'] = FALSE; $config['sess_time_to_update'] = 9000; $config['sess_regenerate_destroy'] = FALSE;

Thanks Hitesh

dreamcoder8 commented 4 years ago

@narfbg - could you explain the reason to close the bug?

narfbg commented 4 years ago

You just said your sessions are being destroyed and posted a configuration. That's not a bug. That's not even an attempt at describing a bug.

dreamcoder8 commented 4 years ago

Sorry if you feel that way. Unfortunately I don't see any other way to describe it. I am not at posting/reporting bug at Github as most of the times I debug & troubleshoot myself or with the help of community answers on the internet.

If you could help me with what description you would be appropriate that would be good.

Let me try and explain again and let me know it's helpful to get the idea

I am developing a website for client with the framework and having some auto logout issue which I have never faced before while using CodeIgniter. I am loading session from autoload and only place where session could be destroyed is logout function inside main.php (controller).

This is how the current flow works

  1. User login
  2. User goes to wallet page
  3. Add Money
  4. Redirected to payment gateway
  5. Redirected back with post data to website to process_payment function, inside main.php (controller)
  6. Data is processed and user is redirected back to wallet page

Everything is good until step 4 but on step 5 and then user is redirected back to process_payment. This is where I check if session exist by printing whole session data. Most of the time it works but sometimes it auto logout user/session destroyed.

Thanks for the help.

Regards Hitesh

narfbg commented 4 years ago

OK, here's the thing ...

We expect people who come here to be reporting bugs within the framework itself, so we can fix them. You're not reporting a bug, you're looking for help to debug your own application - those are different things. You should seek help on our forums or a site like StackOverflow.

dreamcoder8 commented 4 years ago

Just reported here because thought there is some issue on session library because after developing close to 50 applications I never had this issue on any version of the framework before. I will post on forums if required.

Thanks for the help, keep doing great work.

mckaygerhard commented 4 years ago

@dreamcoder8 i have same issue. seems the redirect fusile the sesion object.. validating session IDs.

dreamcoder8 commented 4 years ago

@mckaygerhard - Hey, I replaced core files with latest version of core files which worked for me. Also make sure you have right permission for folders.

mckaygerhard commented 4 years ago

@mckaygerhard - Hey, I replaced core files with latest version of core files which worked for me. Also make sure you have right permission for folders.

that does not work.. i checkd as i setup in #5974 and worked.. we have two server production.. one with php 5.6 supported by vendor and another with php 7.1 in both fails.. so i setup the cookie id and seems works. some guy tell me about the id assing in CI are in some work now.. maybe there's a big bug here!

dreamcoder8 commented 4 years ago

Seems like I was lucky to get it solved by replacing core file as I did not find any support for same. I have not have new CI project since then as have been working on vue, node, wp, etc. so don't know if that still persist with newer version.

narfbg commented 4 years ago

@mckaygerhard Stop spamming every issue thread that mentions "session" and "destroyed".