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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 05:01:34 2025 UTC