Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to 'unset' session save handler?

Tags:

php

session

For some reason I have to initialize session with default save handler.

Previous code explicitly sets custom handler with session_set_save_handler().

Changing previous code is not a realistic option in my situation, so does anyone know how to restore handler to default eg is there session_restore_save_handler or session_unset_save_handler functions or equivalents?

like image 411
Miloš Đakonović Avatar asked Nov 27 '25 12:11

Miloš Đakonović


1 Answers

As of PHP 5.4 you can revert to the default session handler by instantiating the SessionHandler class directly:

session_set_save_handler(new SessionHandler(), true);
like image 155
kendsnyder Avatar answered Nov 29 '25 06:11

kendsnyder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!