ID: 32279 Updated by: [EMAIL PROTECTED] Reported By: pguilbault at iweb dot ca Status: Open Bug Type: Session related PHP Version: 5.0.3 New Comment:
The way ZE is designed, this behavior is pretty darned unlikely to change anytime before PHP7. HOWEVER: I would qualify it as an "undocumented feature", as such it is subject to removal without notice. So use at your own risk. Plus, as sniper said, if your PHP was compiled with --disable-session then $_SESSION will be unavailable anyway. To ensure maximum compatability you're best off use $GLOBALS['somevar']['index'] = 'foo'; or global $somevar; $somevar['index'] = 'foo'; Previous Comments: ------------------------------------------------------------------------ [2005-03-12 19:23:30] [EMAIL PROTECTED] Well, personally I don't think it's a bug. Other autoglobals are registered in the same time too (i.e. at module init time). ------------------------------------------------------------------------ [2005-03-12 14:43:42] [EMAIL PROTECTED] Yes, it's definately a bug. And I wouldn't suggest using $_SESSION like that as we might a) fix this bug b) this won't work if session extension is not enabled.. ------------------------------------------------------------------------ [2005-03-11 15:54:38] pguilbault at iweb dot ca Description: ------------ Without using session_start() and setting $_SESSION['test']='hi there'; in a class and echoing thise $_SESSION['test'] outside the class with echo the 'hi there'... I was told it was a bug... Althougth I am hoping it is NOT a bug and that I will be able to use that super global for my Session Management class. So I can use $_SESSION['test'] in my classes instead of $GLOBAS['session_vars']['test']. which is way too long for my test. Reproduce code: --------------- class tester() { function __construct() { $_SESSION['test'] = 'hi there'; } } $test = new tester(); echo $_SESSION['test']; Expected result: ---------------- hi there ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32279&edit=1