session_start() should not reset $_SESSIOn if it's not empty

From: Date: Thu, 27 Jul 2017 17:03:23 +0000
Subject: session_start() should not reset $_SESSIOn if it's not empty
Groups: php.internals 
Request: Send a blank email to internals+get-100065@lists.php.net to get a copy of this message
currently i try to optimize our system so that the landing-page if it does not contain forms and when no user is logged in could be cached with APCu which works fine so far there is still a early session_start(); and while delay that would be probably possible like it's happening currently with database connection on-demand but there are some important things written in $_SESSION which i can't delay and the sample below shows that they would get lost in case it's not a cache hit ___________________________________ <?php declare(strict_types=1); if(!empty($_SESSION['test'])) { echo $_SESSION['test']; } $_SESSION['test'] = 'test'; session_start(); ___________________________________ 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

« previous php.internals (#100065) next »