Bug #75946 [Com]: session_start() fails after fastcgi_finish_request() (FPM)

From: Date: Sat, 10 Feb 2018 09:57:20 +0000
Subject: Bug #75946 [Com]: session_start() fails after fastcgi_finish_request() (FPM)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213904@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75946&edit=1 ID: 75946 Comment by: spam2 at rhsoft dot net Reported by: rafal dot janiczek at gmail dot com Summary: session_start() fails after fastcgi_finish_request() (FPM) Status: Open Type: Bug Package: Session related Operating System: Linux PHP Version: 7.1.14 Block user comment: N Private report: N New Comment: this is not a bug! you can't start a session after data was sent to the client which happens with fastcgi_finish_request() as "This function flushes all response data to the client and finishes the request. This allows for time consuming tasks to be performed without leaving the connection to the client open" clearly states why do you believe that this piece of code ever did what you think? the only difference is that PHP now tells you that your code is and was always broken and thinking abotu what session_start() does - sending a HTTP header - that becomes obvious Previous Comments: ------------------------------------------------------------------------ [2018-02-10 09:11:57] rafal dot janiczek at gmail dot com Description: ------------ Not affected: php 7.0.x Affected: php7.1.x (tested .14) and php7.2.x (tested .2) Test script: --------------- <?php session_start(); echo session_id()."\n"; $_SESSION['test'] = 1; echo "stop session\n"; session_write_close(); fastcgi_finish_request(); session_start(); $_SESSION['test'] = 2; session_write_close(); $status = session_start(); if ($status) file_put_contents("sesstest.log", date("Y-m-d")." OK ".$_SESSION['test']." ".session_id()); else file_put_contents("sesstest.log", date("Y-m-d")." ERR ".$_SESSION['test']." ".session_id()); Expected result: ---------------- string "OK 2" in sesstest.log Actual result: -------------- string "ERR 1" in sesstest.log ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75946&edit=1

« previous php.bugs (#213904) next »