Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100082 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71477 invoked from network); 28 Jul 2017 13:37:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jul 2017 13:37:19 -0000 Authentication-Results: pb1.pair.com header.from=lists@rhsoft.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=lists@rhsoft.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain rhsoft.net designates 91.118.73.15 as permitted sender) X-PHP-List-Original-Sender: lists@rhsoft.net X-Host-Fingerprint: 91.118.73.15 mail.thelounge.net Received: from [91.118.73.15] ([91.118.73.15:27511] helo=mail.thelounge.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/45-40376-A0E3B795 for ; Fri, 28 Jul 2017 09:37:15 -0400 Received: from srv-rhsoft.rhsoft.net (Authenticated sender: h.reindl@thelounge.net) by mail.thelounge.net (THELOUNGE MTA) with ESMTPSA id 3xJqdf6dmmzXMf for ; Fri, 28 Jul 2017 15:37:10 +0200 (CEST) To: internals@lists.php.net References: <28093140-0D0D-4157-AAA3-E8F1A570E67A@gmail.com> Message-ID: Date: Fri, 28 Jul 2017 15:37:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <28093140-0D0D-4157-AAA3-E8F1A570E67A@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-CH Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] session_start() should not reset $_SESSIOn if it's not empty From: lists@rhsoft.net ("lists@rhsoft.net") Am 28.07.2017 um 14:48 schrieb Rowan Collins: > On 27 July 2017 18:03:23 BST, "lists@rhsoft.net" wrote: >> if that could work in the way that session_start() keeps the current >> state of $_SESSION if not empty it would be possible to put the >> APCU-Read and if exit($apcu_content); before session_start() which >> would >> gain another 30% performance > > I think that behaviour would confuse more people than it would help. If anything, it should be an error to access $_ SESSION if no session is currently open - if there is no session, the array has no meaning. (Arguably, all the other superglobals should be read only for the same reason, but that would be a huge break now.) make them readonly would break my whole codebase including autotests and code-coverage tools because it is legit to as example fill $_SERVER['SERVER_NAME'] with specific informations to define a straight behavior when running in cli-test-mode instead wrap every basic thing in function calls - at the curretn state a core-cms cache-hit has a total of 32 funtion calls including PHP internal ones hence that 3 bugreport are becoming a MAJOR PROBLEM because the system itself is so fast that under load after a short time you get problems with dattabase connections and with persistent connections because of the third one after the load is gone any strict-typed application jsut breaks horrible https://bugs.php.net/bug.php?id=74971 https://bugs.php.net/bug.php?id=74970 https://bugs.php.net/bug.php?id=74967 > If I understand you right, the scenario you describe is "I don't want to start a session yet, but if and when I do, I want to put this data into it". It feels like that could be adequately handled in userland with a wrapper object (or global var and functions if you prefer), which reads to and from $_SESSION when a session is open, but a a holding array when it's not yet. that don't work because at this point you don't know in userland if you started a completly new session which should be initialized with values for follow-up requests or use the existing values from a previous request - at least not without writing ugly code session_start() knows that and would only need a flag if it is desired to bail out as you said above or as for this case init the session with specific values