|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2018-04-10 17:14 UTC] tilmann dot bach at telekom dot de
[2018-05-01 20:02 UTC] pmmaga@php.net
-Status: Open
+Status: Analyzed
-Package: Session related
+Package: Apache2 related
-Assigned To:
+Assigned To: pmmaga
[2018-05-01 20:02 UTC] pmmaga@php.net
[2018-05-01 20:12 UTC] pmmaga@php.net
[2019-03-19 14:14 UTC] marthasimons8888 at gmail dot com
[2020-03-25 15:48 UTC] pmmaga@php.net
-Assigned To: pmmaga
+Assigned To:
[2021-04-22 16:46 UTC] cmb@php.net
[2024-05-17 14:29 UTC] marthasimons8888 at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 17:00:01 2025 UTC |
Description: ------------ When calling session_start() and then session_regenerate_id(), PHP will send two Set-Cookie headers, one containing the old session id and the other containing the new session id. Testet on: * PHP 7.1.11 on Ubuntu 12.04 (installed via phpbrew) * PHP 7.0.22-0ubuntu0.16.04.1 on Linux Mint 18 Test script: --------------- First, create sessiontest.php: <?php session_start(); if (!isset($_SESSION['SessionInitiated'])) { session_regenerate_id(); $_SESSION['SessionInitiated'] = true; } ?> Then, access sessiontest.php through Apache and inspect response headers, e.g. by using curl: curl -sv http://localhost/sessiontest.php > /dev/null * Trying 127.0.1.1... * Connected to localhost (127.0.1.1) port 80 (#0) > GET /sessiontest.php HTTP/1.1 > Host: localhost > User-Agent: curl/7.47.0 > Accept: */* > < HTTP/1.1 200 OK < Date: Wed, 22 Nov 2017 12:07:52 GMT < Server: Apache/2.4.18 (Ubuntu) < Set-Cookie: PHPSESSID=8676mem4p76uka76ta2qq072q1; path=/ < Expires: Thu, 19 Nov 1981 08:52:00 GMT < Cache-Control: no-store, no-cache, must-revalidate < Pragma: no-cache < Set-Cookie: PHPSESSID=rvud0d79be3oa77rnbag0lmgc2; path=/ < Content-Length: 0 < Content-Type: text/html; charset=UTF-8 Expected result: ---------------- Only send one Set-Cookie header (containing the new session id). Actual result: -------------- Two Set-Cookie headers are sent, one containing the old session id and the other containing the new session id. This confuses browsers and cause some browsers to continue using the old session cookie. In addition, if you call var_dump(headers_list()) at the end of the script, only ONE Set-Cookie header will be listed here, even though two headers are sent.