Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81358 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24034 invoked from network); 29 Jan 2015 08:05:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jan 2015 08:05:29 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.50 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.192.50 mail-qg0-f50.google.com Received: from [209.85.192.50] ([209.85.192.50:62210] helo=mail-qg0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2E/C2-09212-8C9E9C45 for ; Thu, 29 Jan 2015 03:05:28 -0500 Received: by mail-qg0-f50.google.com with SMTP id f51so24955155qge.9 for ; Thu, 29 Jan 2015 00:05:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=f7+7Yq8+gNY/GOW9WqHF5hAFroPUqs9mJq92FvpqZL8=; b=fiWiFOahmVR+O5DZZnTy8xbJCCulgPAGi7Jo3PA/cOGBjXniCHvlvq096Pcxqh14fZ BfVpyF4eJjub4LkTAfVgR00LUDjvCR7azE5EGUWePCCPohRagZVjtEFptPXEuJQ4wTsM o4wKytUe/fSoBGaQaQQOtG3qkrEkvwJtqxPq+jO2RjdwPUYMKvXakxHQRuMjw7UM/hRH VBLkVZ4nlW0U1fMh1Qy8Lh5kjUdQSukpRrDtCAu8SXkqQtLE7pL+C5O3Sk7iygRm399T z/XLFxks55tTaEjMJMC45CdJHxJK57rKBCGXknQhNsbCaAtb4Zc596zabQylMnfV/6sG +6cA== X-Received: by 10.224.28.198 with SMTP id n6mr21756062qac.15.1422518725752; Thu, 29 Jan 2015 00:05:25 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.93.70 with HTTP; Thu, 29 Jan 2015 00:04:45 -0800 (PST) In-Reply-To: References: Date: Thu, 29 Jan 2015 17:04:45 +0900 X-Google-Sender-Auth: 1esFdwvuKZVvTyoSYp1gnSz9BxA Message-ID: To: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c2cc9a55bd4b050dc5f3c9 Subject: Re: Session: PS(mod)->create() or PS(mod)->read() parameter? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c2cc9a55bd4b050dc5f3c9 Content-Type: text/plain; charset=UTF-8 Hi all, On Thu, Jan 29, 2015 at 4:00 PM, Yasuo Ohgaki 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 --001a11c2cc9a55bd4b050dc5f3c9--