php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48223 Override $_COOKIE forces new session ID
Submitted: 2009-05-10 14:53 UTC Modified: 2009-05-10 15:47 UTC
From: martijn at site-to-make dot nl Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.2.9 OS: Debian 5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: martijn at site-to-make dot nl
New email:
PHP Version: OS:

 

 [2009-05-10 14:53 UTC] martijn at site-to-make dot nl
Description:
------------
If $_COOKIE is overriden in a script, every request a new session id is generated. The old session data will not be loaded again.

Reproduce code:
---------------
<?php
$_COOKIE = null;
session_start();

if (!isset($_SESSION['views']))
	$_SESSION['views'] = 1;
else
	$_SESSION['views']++;
	
echo $_SESSION['views'];

Expected result:
----------------
Incrementing value and session should use the internal cookie values

Actual result:
--------------
1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-10 15:47 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

1) you should not manipulate super globals but only it's elements
2) sessions relying n $_COOKIE is the expected behavior
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 06:01:35 2024 UTC