Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73195 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28263 invoked from network); 16 Mar 2014 16:48:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2014 16:48:01 -0000 Authentication-Results: pb1.pair.com header.from=narf@devilix.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=narf@devilix.net; spf=pass; 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:52952] helo=mail-yh0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/A0-20890-FB5D5235 for ; Sun, 16 Mar 2014 11:48:00 -0500 Received: by mail-yh0-f41.google.com with SMTP id v1so4477618yhn.0 for ; Sun, 16 Mar 2014 09:47:57 -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=DNC+j2eyLV0iAMU3qKT6z7LELNRRgKIK3XJZenznRbM=; b=MT8Rkh+XFtyVfy3cFDvy1/3/Fmsvcad9WLR67dxR1+qS1pbHKq4IL4A+1Y9l5Qcbnn swzW8j9OV7kyOdOzKsqiU9dcBdXSvOk83jvAcc0Dg7VLwDPFkKzztm92ojgu/us2hMXu LWBHSvT4sbxgXGfr79f74GUbLVvhFOlnEI8So= 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=DNC+j2eyLV0iAMU3qKT6z7LELNRRgKIK3XJZenznRbM=; b=k1cbhBBd8gGwAw21ErbEtZ3atVUSbSmx/M4ZLw9HvtsFLPAaIwxrC+Nr62/zySYNOa 7Wv08PvUf2Mr4o1tWkstwPy1OuWgbUKYpFI7GkwTjrVjyN5US85AYDWI9oIaTUFKoGUf Iz4DwRZdt32C3NBO5DmauEO16VLSn6NTa5GmE8UWM9RsGaJe1yGTeLX7wAoZ/GltUjuT 6R1DL2cMBNGthcO6UECfrEZ9QVW4tZN9GpeZdm7Vh98RxrYO+rffsCsosuzRsPs6IIJY 37ZFcTfSY9wqqSNBJhe6RdQdBz0+c7tjRTeQtNGXub14E28pLV9bVFuTSNMc4WrHFg7e m4PA== X-Gm-Message-State: ALoCoQnxqsYUNeT2o7GH5wh8hAGBlHfr1DtLOxndaQnvlbvr+V/pmctSB7KIDq4rO4rvZ57nHUq+ MIME-Version: 1.0 X-Received: by 10.236.86.226 with SMTP id w62mr2818297yhe.94.1394988477106; Sun, 16 Mar 2014 09:47:57 -0700 (PDT) Received: by 10.170.188.139 with HTTP; Sun, 16 Mar 2014 09:47:57 -0700 (PDT) In-Reply-To: References: Date: Sun, 16 Mar 2014 18:47:57 +0200 Message-ID: To: Yasuo Ohgaki Cc: "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, On Sun, Mar 16, 2014 at 7:32 AM, Yasuo Ohgaki wrote: > // $_SESSION['logged_in'] has been set in a previous request > Request 1: session_start(['read_only' => TRUE]); > Request 2: session_start(); unset($_SESSION['logged_in']); > session_write_close(); > Request 1: if ($_SESSION['logged_in']) { /* logic */ } // evaluates to TRUE > > > Your example ends up with the same result regardless of "read_only". > If Request 1 locks session data, it finishes execution as logged_in==TRUE. > > There may be race condition like this. However, it does not matter much if > legitimate users' requests are processed as authenticated or not under such > race condition. It's _legitimate_ users' request anyway. Read the explanation in my previous mail: http://marc.info/?l=php-internals&m=139498773308515 > If apps must not allow such race condition, any of > session_write_close/commit(), read_only > should not be used. (Request serialization is not perfect still, though. > Please read > session_regenerate_id() thread for details.) It's about making a conscious choice of when to use it, not if at all. The name, and it's presence as an option instead of a separate function is misleading. > 2. The RFC describes that with 'lazy_write' set to TRUE, if no change was > made to session data, then PS_UPDATE_FUNC() will be called instead of > PS_WRITE_FUNC(). However, it only talks about internal implementation and > fails to address (or at least mention) that a custom session handler should > now also have an update() method. > > > This is not correct. > User defined save handler does not have to implement update() method. > Session module is designed to allow omitting new method/function just > like undocumented create_sid() function/method. There are test cases > for it. (BTW, I noticed that I missed to compare dummy function address. > It's fixed in my repository already.) It's not incorrect, the RFC doesn't mention this case and what it happens in it. I admit, I haven't looked at the patch and the tests, but if PS_UPDATE_FUNC() doesn't exist, how would you call it? The session ID is something consumed by (or passed to) the session handler, there's a big difference. > "lazy_write" could be INI option and default to false, but it makes little > sense > because it is compatible with current behavior. I cannot think of good > reason to > disable it, but it may be disabled if you need. > > I don't see good reason to postpone this change still. Again, nothing explains how that compatibility is maintaned and this is exactly the concern that I have. When something is unknown, it usually produces side effects. Cheers, Andrey.