Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73334 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95853 invoked from network); 20 Mar 2014 11:19:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2014 11:19:19 -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.213.41 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.213.41 mail-yh0-f41.google.com Received: from [209.85.213.41] ([209.85.213.41:39479] helo=mail-yh0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 58/0B-33112-6BECA235 for ; Thu, 20 Mar 2014 06:19:19 -0500 Received: by mail-yh0-f41.google.com with SMTP id v1so598116yhn.14 for ; Thu, 20 Mar 2014 04:19:16 -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=5feK6Y/ynI+vHM2aMZgV0uMJekOcvcN1oW0Sx2YhqJY=; b=sfzy80RzaWzqi9ryizZLJ5z2uKcRg65H/o+SPeYK+Xwt2tzsiq1rct1+Hj8LhIyLQm WaKamg3nVIixL1zW7wMmX1tni+dICvgPJbGtJRFBskYKFja/DS/sg0Dl8J5CKvchIuC6 LibfOlpimEQLHlrj1fjwkyruIGEIumObp6BM4= 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=5feK6Y/ynI+vHM2aMZgV0uMJekOcvcN1oW0Sx2YhqJY=; b=WmlRVpFgp3btHuNWCEjLT4rL7Py+LEHh+o3CcWECTknSHLmKhKeKGL9amWim8TEwWv kqEPnK++rXJ0Z4y9GcRkCIq8ZfSULM6/xD/tk4X/doxi5wNFWwMqrb7H8P2N5qG7zP41 V5V5eoxWablTjIjmNPaRIWtVhlWF0sfWIzJuajLc2GytRJRyE7eDatVoHVal/VlGphiZ EzyvaAdPON5eNraWZOtJ8lkEhcV3XScrzmPHComg4jDY5WdOJNanU1QjgvDfdXPTq2zt rreMWxJoz1bKL1YXUP2GLpWgikHGF1Lgb9a0fnJsA+sGGIGrl6gyJnd5qm6GlWSW9kAK Snlg== X-Gm-Message-State: ALoCoQko4B4k7h1Ve9p6M5VHbby1dRZ0EyGH+tp/Ftf/yz+KbLmMMumGM5Qv8seVIge9W8QOHkdu MIME-Version: 1.0 X-Received: by 10.236.142.198 with SMTP id i46mr58244182yhj.66.1395314356192; Thu, 20 Mar 2014 04:19:16 -0700 (PDT) Received: by 10.170.188.139 with HTTP; Thu, 20 Mar 2014 04:19:15 -0700 (PDT) In-Reply-To: References: <5324FE40.1070704@sugarcrm.com> <532603A0.8060802@sugarcrm.com> <5327DD6E.6030402@sugarcrm.com> Date: Thu, 20 Mar 2014 13:19:15 +0200 Message-ID: To: Yasuo Ohgaki Cc: Stas Malyshev , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Revert/extend/postpone original RFC about read_only, lazy_write sessions From: narf@devilix.net (Andrey Andreev) Hi all, I did this prototype/concept about SessionHandler, SessionHandlerInterface in PHP 5.6: https://gist.github.com/narfbg/9643416 In the context of this discussion, the important part is the updateTimestamp() method (in relation to 'lazy_write'), you should ignore the rest (for now). I want to discuss it here first before updating the RFC with it. So, I had a chat with Yasuo about it to identify the problems and/or limitations and this is the most important one: The patch (https://github.com/php/php-src/pull/628) doesn't allow calling parent::updateTimestamp() and users should call parent::write() instead. This is because there are PECL extensions that provide a session handler and they won't have support for that, which is hard to detect at runtime. However, I don't think that this is convenient, nor that documenting this is better than documenting that PECL extensions might not support the parent::updateTimestamp() call. To me, that's an unnecessary limitation and here are the alternatives: 1. Don't declare SessionHandler::updateTimestamp() if session.save_handler doesn't support it and put a big red warning in the docs that PECL extensions might lack the method. I think this is a good trade-off, given that most users trust (or have) only "stock" PHP extensions and can benefit from this. Also, this wouldn't be a precedent - you can take mysqli and it's dependancies on mysqlnd for example (where the docs mention this very briefly). 2. Scrap the updateWhatever() method and just modify write() to only update the timestamp when necessary. I have no idea why nobody has thought about this previously. The 'lazy_write' idea is inspired by a feature request from 2002 (https://bugs.php.net/bug.php?id=17860) that simply asks for an API identifying whether $_SESSION has been changed or not, or in other words - and API saying whether session data or only the timestamp should be updated. Now, Yasuo prefers providing explicit API for the lazy_write feature (namely, the updateTimestamp() method), but simply providing such a flag via i.e. yet another magic constant, similar to SID, solves ALL of the problems: - No API changes - No BC breaks - No effect on PECL extensions that don't support it IMO, that's way more flexible and would allow doing lazy_write by default, no option - after all, the feature represents a performance improvement. It also solves another, side-effect problem: the SessionUpdateTimestampInterface, that currently exists only because of internal implementation details. Thoughts? More suggestions? Concerns? Cheers, Andrey.