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_write_close(): Session callback expects true/false return value #15717

Closed
lcharette opened this issue Oct 2, 2016 · 3 comments
Closed

Comments

@lcharette
Copy link
Contributor

lcharette commented Oct 2, 2016

  • Laravel Version: 5.3
  • PHP Version: 7.0.8

Description:

Since I upgraded my test server to php7, I get this warning in the logs :

PHP Warning:  session_write_close(): Session callback expects true/false return value in Unknown on line 0
PHP Warning:  session_write_close(): Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/lib/php/sessions) in Unknown on line 0

We use Illuminate/Session FileSessionHandler (See here).

According to this thread, the write method of the session handler needs to return true. Adding return true; here will fix the warning message : https://github.com/illuminate/session/blob/master/FileSessionHandler.php#L81-L84

This probably apply to other Session handler inside Illuminate/Session as well.

@GrahamCampbell
Copy link
Member

GrahamCampbell commented Oct 2, 2016

We don't use the session_write_close function?

@lcharette
Copy link
Contributor Author

From what I understand, session_write_close is called during a normal shutdown, so when a page is done loading.

See: http://php.net/manual/en/sessionhandlerinterface.write.php

@lcharette
Copy link
Contributor Author

Turns out this warning can also be fired when session_destroy and session_regenerate_id is called...

taylorotwell pushed a commit that referenced this issue Oct 18, 2016
* Fix session_write_close(): Session callback expects true/false return value

#15717

* Fix Styling

* Fixed same error with `session_destroy`
symfony-splitter pushed a commit to illuminate/session that referenced this issue Oct 18, 2016
* Fix session_write_close(): Session callback expects true/false return value

laravel/framework#15717

* Fix Styling

* Fixed same error with `session_destroy`
bepsvpt pushed a commit to bepsvpt-fork/framework that referenced this issue Oct 18, 2016
* Fix session_write_close(): Session callback expects true/false return value

laravel#15717

* Fix Styling

* Fixed same error with `session_destroy`
taylorotwell pushed a commit to illuminate/session that referenced this issue Sep 17, 2018
* Fix session_write_close(): Session callback expects true/false return value

laravel/framework#15717

* Fix Styling

* Fixed same error with `session_destroy`
duksis added a commit to duksis/SessionHandlerCookie that referenced this issue Jul 4, 2022
fixes stevencorona#11 

One possible solution for the warning messages in logs described in stevencorona#11 
following the example of Laravel laravel/framework#15717
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