From: nick at blackisha dot com
Operating system: debian testing
PHP version: 4.3.4
PHP Bug Type: Scripting Engine problem
Bug description: Session variably overwritten with global variable
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) {}}
--
Edit bug report at http://bugs.php.net/?id=28144&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28144&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28144&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28144&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28144&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28144&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28144&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28144&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28144&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28144&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28144&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28144&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28144&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28144&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28144&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28144&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28144&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28144&r=float