#21821 [Bgs]: Unsetting $_COOKIE[session_name()] shouldn't warn, but send new cookie
| From: | sniper@php.net | Date: | Thu, 23 Jan 2003 01:26:38 +0000 |
| Subject: | #21821 [Bgs]: Unsetting $_COOKIE[session_name()] shouldn't warn, but send new cookie | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-30984@lists.php.net to get a copy of this message | ||
ID: 21821
Updated by: sniper@php.net
Reported By: msopacua@php.net
Status: Bogus
Bug Type: Session related
Operating System: BSD/OS 4.2
PHP Version: 4.3.0
New Comment:
And this really doesn't work like that..
You can't set/unset cookies by mangling the $_COOKIE[] array anyway.
Please ask support questions elsewhere.
Previous Comments:
------------------------------------------------------------------------
[2003-01-22 11:49:29] msopacua@php.net
Ahum - NULL (inserted for readibility) apparently is '' not, void.
------------------------------------------------------------------------
[2003-01-22 11:43:11] msopacua@php.net
The following script:
<?php
error_reporting(E_ALL);
if(isset($_COOKIE[session_name()]) &&
!file_exists(session_save_path(NULL) . '/sess_' . session_id(NULL)))
unset($_COOKIE[session_name()]);
ini_set('session.use_only_cookies', TRUE);
ini_set('session.cookie_lifetime', 7 * 24 * 3600);
ini_set('session.gc_lifetime', 7 * 24 * 3600);
session_start();
?>
<html>
<body>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?foo=<?php echo time();
?>">refresh</a>
<pre>
<?php var_dump($_SESSION); ?>
</pre>
</body>
</html>
<?php
$_SESSION['test'] = 'hi' . $_GET['foo'];
?>
Creates warnings about illegal chars in the session id. However - there
is no valid session here, as there is no valid cookie. It should send a
new cookie instead, with a new generated session id. However - it sets
an empty id:
Set-Cookie: PHPSESSID=; expires=Wed, 29-Jan-2003 17:37:42 GMT; path=/
If I also unset $_SESSION, it doesn't change anything.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21821&edit=1