|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-02-04 16:07 UTC] David dot Gausmann at measX dot com
Description: ------------ In a productive website of a customer I need to start/stop the session multiple times during the execution of a single PHP script. In some cases the proxy server had thrown HTTP error 502 that the header is too long. I've found out, that session_start always adds a Set-Cookie header, regardless of the fact that there is already exactly the same header line. This bug has already been reported here, but is still unfixed, so I create a new bug report: https://bugs.php.net/bug.php?id=38104 https://bugs.php.net/bug.php?id=31455 Test script: --------------- <?php session_name('Test'); session_cache_expire(180); session_set_cookie_params(0, '/', '', false, true); for($i = 0; $i < 10000; ++$i) { session_start(); session_write_close(); } ?> Expected result: ---------------- Set-Cookie: Test=68nh86r3ks6jo6tughb7d3u7a5; path=/; HttpOnly (exactly one time) Actual result: -------------- Set-Cookie: Test=68nh86r3ks6jo6tughb7d3u7a5; path=/; HttpOnly Set-Cookie: Test=68nh86r3ks6jo6tughb7d3u7a5; path=/; HttpOnly Set-Cookie: Test=68nh86r3ks6jo6tughb7d3u7a5; path=/; HttpOnly Set-Cookie: Test=68nh86r3ks6jo6tughb7d3u7a5; path=/; HttpOnly Set-Cookie: Test=68nh86r3ks6jo6tughb7d3u7a5; path=/; HttpOnly Set-Cookie: Test=68nh86r3ks6jo6tughb7d3u7a5; path=/; HttpOnly ... (10000 times) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 03:00:01 2025 UTC |
I've fixed that session module sending multiple set cookie headers, a year ago or so. IIRC. OS/SAPI shouldn't matter. Are you sure you're using PHP7? [yohgaki@dev PHP-7.0]$ ./sapi/cgi/php-cgi <?php session_name('Test'); session_cache_expire(180); session_set_cookie_params(0, '/', '', false, true); for($i = 0; $i < 10000; ++$i) { session_start(); session_write_close(); } ?> X-Powered-By: PHP/7.0.4-dev Set-Cookie: Test=64082c017c50d407647dd29ecb0874e4; path=/; HttpOnly Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache Content-type: text/html; charset=UTF-8