PHPoAuthLib icon indicating copy to clipboard operation
PHPoAuthLib copied to clipboard

Why is session_write_close() called in Session class?

Open devdemi opened this issue 10 years ago • 5 comments

I use your lib with Zend Framework 1.x, but after your lib has done it's work I need to add some info to session, but session is already closed. Class Session has destructor, that why I can't add data to session

    public function __destruct()
    {
        if ($this->startSession) {
            session_write_close();
        }
    }

Why lib uses this destructor?

devdemi avatar Mar 23 '15 14:03 devdemi

We're having the same issue by the way. After the library finishes execution we're locked out of our session. Fix please :)

duronrulez avatar Apr 01 '15 11:04 duronrulez

Hey, can you just start you session before you load OAuth Session class. Also, if you still face inconvenience - I can add parameter to prevent session close or close session only if session started manually and load session in lazy manner - when it's really needed.

If you need the fix, please open issue on my fork

logical-and avatar Apr 05 '15 16:04 logical-and

@logical-and I need that fix, in my case I'm using sessions just after

json_decode($googleService->request('https://www.googleapis.com/oauth2/v1/userinfo'), true);

Now that I updated this library my code stopped work, I had a terrible time trying to guess what the problem is :/

carloscarcamo avatar Oct 20 '15 01:10 carloscarcamo

This issue also came up for me. This caused my other unrelated sessions to not write correctly.

alexmglover avatar May 11 '16 16:05 alexmglover

This is a great library and I've used it a bunch... but this one line has cost me many development hours over the last few years.

I'm writing a comment because maybe then I won't forget about this. A year later I'll be upgrading/switching servers/doing another project with social login... and completely forget and then waste a few more hours wondering why my sessions don't work because of this line.

mrieck avatar Dec 26 '18 19:12 mrieck