|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-06-05 09:49 UTC] tony at marston-home dot demon dot co dot uk
Description:
------------
The manual page for session_name() has recently been updated to include the following:
"When new session name is supplied, session_name() modifies HTTP cookie (and output contents when session.transid is enabled). Once HTTP cookie is sent, session_name() raises error."
I have run several tests, and I cannot see this behaviour, nor has it ever been the behaviour in all past versions of PHP.
Changing the session name does not create or modify any cookies. Session cookies are only created with session-start() and modified with session_regenerate_id().
It is also possible to create a cookie before calling session_name('newname') without any error.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
I'm not sure who does the update, but sentence is correct. Cookie sent checks(session_id() and session_name()) were there for a long time. Try "php -a", then echo 1 session_name('new'); // or session_id('new');If you are not sure who does the update then you need to check. Try running the following code: <?php $dump = print_r($_COOKIE, true); $name = session_name(); session_name('newname'); // cookie will not show up until next run exit; Now try running it again. You will see that $_COOKIE does NOT contain an entry for 'newname'. This is because the cookie is NOT created by session_name(). It is only created with the subsequent call to session_start() when both the name and id are available. The documentation is NOT accurate, therefore it should be amended.