Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73475 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18559 invoked from network); 28 Mar 2014 23:41:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Mar 2014 23:41:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=narf@devilix.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=narf@devilix.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain devilix.net designates 209.85.160.177 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.160.177 mail-yk0-f177.google.com Received: from [209.85.160.177] ([209.85.160.177:41507] helo=mail-yk0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/72-33588-99806335 for ; Fri, 28 Mar 2014 18:41:18 -0500 Received: by mail-yk0-f177.google.com with SMTP id q200so4303767ykb.36 for ; Fri, 28 Mar 2014 16:41:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=eAodGwbgYHjNINL8du+b2+Qe63zTPt40XxpzpOauC0c=; b=Hq/5B8h6/R7KUTWWEmQARmbMiL4Dw1bjzJi1OqQnYTvvcAJsi7u5QNAwkTBcZuY0Fz izZs48homW39Rm2nlkPcgmfBLwQBQxH0uKW3X3ij/p++tKzITXr4zBDalD0HbCD2KJ5i zi8gACN8XMa37d5ZCzZUCOJu1NXjozPcaFSU4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=eAodGwbgYHjNINL8du+b2+Qe63zTPt40XxpzpOauC0c=; b=N5Hu8rupYmyBa5obJzGDOThpFHpp7GFzn8dSIeHnE6kHcGiBiXJ5j3E4ATL7qp39Mo RVPL0WO3FzkcG8JhOwlngA6MUm1S/gV8vYmUAFGPX0dxXmEqX1CgiYAUdqPlIkqBEbKA 55xVZqZ1JwxZBdlUN4FhdnNAUtAwwX0NSGxmsPnCA3XQ3HpmuKX+Qbg4u16tlcIBAu2e BYpgTuzlfsBd/FGlw1X1JP1uMcXUNUeEGG4fZErGD7HUWcwu2d0b42XXGqQoEcwoV3UE RimeoW7gYzbNg2TsPoGPZKMdkP83R58ufIDzrjbHcA4HUFaAZNaPgZnPfX1/8UWlXBlG YmRA== X-Gm-Message-State: ALoCoQl1RtXGy2p13Id6aADNm+JEsvocexecrRSYvGpL+ciF+tDJLRfcezegv+H02zxoSwjMr4KY MIME-Version: 1.0 X-Received: by 10.236.8.68 with SMTP id 44mr15484931yhq.39.1396050070830; Fri, 28 Mar 2014 16:41:10 -0700 (PDT) Received: by 10.170.188.139 with HTTP; Fri, 28 Mar 2014 16:41:10 -0700 (PDT) In-Reply-To: References: <010e01cf4788$05f3c5a0$11db50e0$@devtemple.com> <01c801cf47c0$59acbf20$0d063d60$@devtemple.com> Date: Sat, 29 Mar 2014 01:41:10 +0200 Message-ID: To: Yasuo Ohgaki Cc: Julien Pauli , Bill Salak , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] session_start(), read_only, lazy_write; Take 2 From: narf@devilix.net (Andrey Andreev) Hi, >> > Without API, manager cannot manage how it behaves. In general, submodule >> > should >> > avoid manager state dependency in general. It should have dedicated API >> > for >> > each >> > distinct task rather than leaving it to managed by submodule. In >> > addition, >> > manager >> > cannot know if save handler supports API or not. If there is API, I can >> > display save >> > handler capability in phpinfo() page, for example. >> > >> > If manager expects sub module to behave in some way, it should have >> > explicit >> > API >> > for each feature. Otherwise, sub module implementation may differ module >> > by >> > module. >> > Defined set of feature is better to have explicit API with modular >> > design. >> > It's not mandatory, >> > but the best practice. I don't see reason not to follow the practice >> > here. >> >> I agree in general, but you just gave a good reason not to follow that >> practice - you can't know if the submodule supports it. Plus, both are >> write operations with one of them just writing more data. I'm all for >> best practices, but in this case there's a lot of sense not to do >> everything by the book. > > > If there is API, sub module capability can be detected. You yourself told me that there's no way for the SessionHandler class to know if the storage module supports PS_UPDATE_TIMESTAMP_FUNC() or not, and that because of that we can't have SessionHandler::updateTimestamp(). > Writing data and updating time stamp for GC is distinct feature. For file-based sessions - it is, but for i.e. a database, there's not much difference. write() does update the timestamp, I see no reason why it shouldn't be able to update just the timestamp. > I don't see good reason not to have API for it. - Not being able to call parent::updateTimestamp() is a good reason. - Having the completely unnecessary SessionUpdateTimestampInterface is a good reason. - Breaking the design of current userland implementations is a good reason. - Not being able to have lazy_write (a performance improvement, I remind you) by default is a good reason. >> > Besides modular design, if write() and updateTimestamp() are merged, >> > flag >> > parameter >> > for write() should be added. It breaks compatibility with current save >> > handlers. I don't >> > want BC that could be avoided also. >> >> No it shouldn't, the decision whether to write or just update the >> timestamp is based on an internal flag, or on $session_data. No >> additional parameters are required. > > > I removed PS(id) dependency from s_read() with new patch as planned. Why > should I introduce new dependency to s_write(), i.e. sub module, that breaks > design? It does not make sense. Convenience and consistency in the userland APIs is more important than "breaking" internal design. I understand you want to stick to best practices, but those practices are not a religion and sometimes you need to break them. If you ask me, a lot of things in ext/session are broken by design ... creating files from inside read() is one example, all methods exposed to userland to be in an interface is another. I agree, it's not perfect, but that's just what happens when we introduce new features into something that was never designed with possible changes in the future in mind. For PHP6, we'll have the freedom to redesign the whole thing completely, but for the time being - userland code is more important than not having some dependancy in write(). Cheers, Andrey.