Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90658 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31553 invoked from network); 15 Jan 2016 09:18:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2016 09:18:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.178 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.160.178 mail-yk0-f178.google.com Received: from [209.85.160.178] ([209.85.160.178:33089] helo=mail-yk0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/61-23660-B59B8965 for ; Fri, 15 Jan 2016 04:18:19 -0500 Received: by mail-yk0-f178.google.com with SMTP id k129so514007202yke.0 for ; Fri, 15 Jan 2016 01:18:19 -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:cc:content-type; bh=+LzxHiXlcC/3Bym+y0Q4wIrHTZGc3isuYsXa2X+Q/ps=; b=hKeBXmugHlMTp+8bWhyOsnuhO7fGKFpRbWoYr0pCz0kodLMiDd8YuCXv6KO+daEiEU iczJjyEqQN3XlUblf0Hwc1sFHUISiCXOpNDLVZwJkJnUkkg2HfPF7Otyot5nWEXOsMbM 0znOGzLiL0HCeUhKIRL45hZJMaRUsscK3P/1i++tgOMsQnhLHDEmHR7CBhhEO5lHckGG dl3PU0TrZqsuMYvQjpgzjRvpdy9QVPuIpS1+9zfiJXsZBjEm8jksdEFoSu24gvNSqLv4 eW+ONZCceOy/n5LWhHUjNFaFaWDq+G8sd4Dq/h93LrtWGq3O+2fRSb7ECtVZFjwLk3wn /Kkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=+LzxHiXlcC/3Bym+y0Q4wIrHTZGc3isuYsXa2X+Q/ps=; b=aRfqnlrZZgD2hzVqWFnWlJqDEoFeenEWrIavceQwvQjMGhJfQxb+f6XTV1gqacYhBP 1Z+/Gdir5taeDLOaMOXfkrHRxnRWf5S4UyC8XQjGUXNcJ7zvbw6eaNjmlzGVUK6cejVD J2zZ3FFveG2ru039Gprqw1K06CkJ7QQheiQ3Kc14FZrjwRkAisp1VYKDGsY2aBqJVi3x kN3qPLVfITUW5X2tOuwd9dOEH7BKeo2gFcwodfyBUGCaszYdGDExP/W5Tbabwy3ZdNII WwE/hlhsAH83EGfyLkTGBXDOzOnoj0+WQWfSxYhDWbpEfgGiG3YtlzWGAxRzcIT4dM5x jr4w== X-Gm-Message-State: AG10YORjFVTcgj4c8rfBT1S/hXeWRIQRTQXJ6Dl7xccRLo/RpTlPvWDso9cJcGJZpZSDhI+Pth5RpmYDnQRZVg== X-Received: by 10.129.113.214 with SMTP id m205mr113172ywc.0.1452849496757; Fri, 15 Jan 2016 01:18:16 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.129.88.139 with HTTP; Fri, 15 Jan 2016 01:17:37 -0800 (PST) In-Reply-To: <5698AC36.30805@gmail.com> References: <56989A57.9030401@gmail.com> <5698AC36.30805@gmail.com> Date: Fri, 15 Jan 2016 18:17:37 +0900 X-Google-Sender-Auth: KbZIOKFHZiRzkHyZ78V9RSAtF4o Message-ID: To: Stanislav Malyshev Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Fixing bug #71038 session_start() returns TRUE on failure From: yohgaki@ohgaki.net (Yasuo Ohgaki) Hi Stas, On Fri, Jan 15, 2016 at 5:22 PM, Stanislav Malyshev wrote: >> Read failure is special because old save handler allowed returning false >> for read and continued as if there is no errors. I cannot fix this without >> braking buggy save handlers compatibility. > > Ah, you mean when read actually worked but handler returns false? If the > session is set up correctly, then returning true is OK I guess. There are many codes like function read($id) { return @file_get_contents(FILE_PATH.$id); } It returns FALSE for non-existing session data. i.e. The first access to the server. To make it work, user should either - check file existence and return '' (empty string) - cast FALSE to "string" to get '' (empty string). e.g. (string)@file_get_contents() So I cannot return FALSE on session_start() read failure w/o breaking existing codes. PHP 7.0 is strict for return values, so session_start() returns FALSE on read failure. Even if it is expected behavior for PHP 7.0, there was bug report on this, though. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net