Re: SessionHandlerInterface protocol

[email protected] ("Christoph M. Becker")
Newsgroups php.general
Message-ID <[email protected]>
On 23.06.2021 at 13:41, Mathieu Dubois wrote:

> Le 23/06/2021 à 12:01, Christoph M. Becker a écrit :
>
>> Before ::read() is called, open() is called.  ::open() is suppossed to
>> create the empty session data, if no data for the given session exist.
>> This empty data string should then be returned from ::read().  If
>> ::read() fails to read the data, it should return false (or actually any
>> non-string value in the current implementation) to signal failure.
>
> I might be confused but the session id is not passed to ::open() so how
> is it supposed to create the empty session data ? By using session_id ?

Ah, right, ::open() is not supposed to create the empty session data.
This can be done in ::read(); the built-in "files" handler does this,
for instance; if the file does not exist and can't be created, ::read()
fails.

Christoph
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.