mercredi 1 février 2017

How to manually call session read without it triggering twice like in Laravel?

Laravel is overriding the php session handler with its own implementation probably in a manner of session_set_save_handler.

They manually call the read method of given handler here, this is the important part:

$this->handler->read($this->getId()

http://ift.tt/2jWGm9h

This directly calls the read method on the session handler. Let's take a DatabaseSessionHandler as an example.

The method it actually calls is just a method that abides to the SessionInterface.

http://ift.tt/2kR63qr

What I don't get though it how is the automatic read suppressed? Even though you have a custom session handler doesn't it still call read whenever you perform a session_start()?

Laravel also manually calls write on a handler. I know when you use a set_session_save_handler that write will be called whenever your script ends. Meaning that if I were to manually call it, it would be triggered a second time when my application's lifecycle would end.

How do they prevent this?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2jCOCbj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire