php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28144 Session variably overwritten with global variable
Submitted: 2004-04-25 14:24 UTC Modified: 2004-04-25 18:24 UTC
From: nick at blackisha dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.3.4 OS: debian testing
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: nick at blackisha dot com
New email:
PHP Version: OS:

 

 [2004-04-25 14:24 UTC] nick at blackisha dot com
Description:
------------
When a class is instantiated globally, and assigned to a variable name which is the same as a session variable, then the session variable get overwritten with the class.

This may happen with non-class variables, but I am not sure.




Reproduce code:
---------------
changing $entrain to anything else (i.e. $entra) fixes the problem.

<?php
session_start();

$entrain = new entrainRuntime();

var_dump($_SESSION);

class entrainRuntime
{
    function entrainRuntime ()
    {
	    $_SESSION['entrain'] = array();
    }
}

?>

Expected result:
----------------
array(1) {"entrain" => array(0) {}}

this happens the first time, expected



Actual result:
--------------
On subsequent refreshes:

array(1) {"entrain" => &bject(entrainruntime)(0) {}}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-25 18:24 UTC] iliaa@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

Appears to be fixed in 4.3.6 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Sep 05 01:00:01 2025 UTC