|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-01-09 15:49 UTC] rene dot bangemann at web dot de
Description: ------------ I'm using a combination of session_start() and session_write_close() to access and update session variables. In some scripts this function calls will be executed up to 50 times. For each call of session_start() a HTTP-Header with the PHP session id will be created in the same HTTP response. I would expect, that in the HTTP response will be only one HTTP-Header with the session id. Reproduce code: --------------- <?php session_start(); session_write_close(); session_start(); session_write_close(); session_start(); session_write_close(); ?> Expected result: ---------------- HTTP-Header Set-Cookie with PHP session id created only once in HTTP response Actual result: -------------- The code above will create a HTTP response with three identical HTTP Set-Cookie headers PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 09:00:01 2025 UTC |
Then how would you handle this (very unlikely :) code: <?php session_name('foo1'); session_id('foobar1'); session_start(); session_write_close(); session_name('foo2'); session_id('foobar2'); session_start(); session_write_close(); session_name('foo3'); session_id('foobar3'); session_start(); session_write_close(); ?> Yes, someone MIGHT rely on that kind of code too. And as it IS possible to start as many _different_ sessions in single request, why should we not allow it? (this is actually for Tony, FYI when he figures out how to fix this bug :)I am experiencing a similar, but not identical problem. I reload my page multiple times, using session_start() every time it loads. JavaScript sets cookies that I use in php. When using Internet Explorer, $_ENV["HTTP_COOKIE"] contains multiple entries for each cookie. This does not happen with Firefox. As near as I can figure so far, when executing code at a domain named x.y.z, Internet Explorer sends the cookies for x.y.z followed by the cookies for y.z. Php then puts both sets of cookies into $_ENV["HTTP_COOKIE"]. Perhaps this may be considered a PHP bug, perhaps not. IMHO, this is an Internet Explorer bug. I post it here in the hope that it may help you resolve your problem. ... Warren Gaebel, B.A., B.C.S.