Re: Session: PS(mod)->create() or PS(mod)->read() parameter?

From: Date: Thu, 29 Jan 2015 08:04:45 +0000
Subject: Re: Session: PS(mod)->create() or PS(mod)->read() parameter?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-81358@lists.php.net to get a copy of this message
Hi all, On Thu, Jan 29, 2015 at 4:00 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: > I would like to improve session save handler module API for PHP7. > When new session data is created, some save handlers need to create > new session data explicitly. e.g. RDBMS based save handler. > > New session module validates session data existence via > PS(mod)->validate_sid(). > When new data record is needed, RDBMS needs INSERT query to create a > record. > Since record existence is checked by validate_sid(), SELECT query in > PS(mod)->read() > that checks record existence is not required if there is proper API. > Note: validate_sid() is there to enforce secure save handler > implementation. > > One option is to have PS(mod)->create() for new session. > The other is additional new_id flag parameter for PS(mod)->read(). > > Both change requires API change, but it wouldn't be issue for PHP7. > > Have new create API or new parameter for PS(mod)->read()? I don't care > which. > If there is no comment, I'll add new parameter since it's simpler. > > Comments are appreciated. > Adding new_id parameter is simple. This is the patch. https://github.com/yohgaki/php-src/compare/master-session-new-api Please note that there is no session save handlers using the new_id flag yet, but the idea may be understood. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net

« previous php.internals (#81358) next »