You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried with output buffering on and off. If I remove session_id() I cannot reproduce it again, but I only used it to create a reproducible example, as in the real project, it's sending duplicate headers even without it.
PHP Version
PHP 8.4 and Apache 2.4.62
> Apache/2.4.62 (Win64) PHP/8.4.0 mod_fcgid/2.3.10-dev
Operating System
Windows 10
The text was updated successfully, but these errors were encountered:
Putting ini_set('session.use_cookies', 'false'); before the second session_start helps but it shouldn't be required. This becomes evident when you execute the script 2 times. The second time there should be 0 Set-Cookie but I still see 2 without this line and 0 with this line.
I haven't tried Windows, but I've tried to reproduce this on macOS at least w/ CLI/CGI and can't get the duplicate header.
My understanding reading it, it initializes the session, calls reset_id, calls send_cookies, calls remove_cookie (which is looking for that specific Set-Cookie: PHPSESSID instance, then munging the header linked list directly, because the SAPI APIs don't have a way to remove a specific one), then appends the new one. That seems to work correctly (it removes the stale Set-Cookie: PHPSESSID, then appends the new one).
That said, I think I might clean up this session/SAPI header code anyways, because it is pretty ugly.
Description
The following code:
Resulted in this output:
But I expected this output instead:
I tried with output buffering on and off. If I remove
session_id()
I cannot reproduce it again, but I only used it to create a reproducible example, as in the real project, it's sending duplicate headers even without it.PHP Version
Operating System
Windows 10
The text was updated successfully, but these errors were encountered: