php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38875 no new variables possible after self::$var = $_SESSION
Submitted: 2006-09-18 22:22 UTC Modified: 2006-09-19 20:10 UTC
From: lagemann at x-wars dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.6 OS: Gentoo 3.3.6, ssp-3.3.6-1.0, pie
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lagemann at x-wars dot net
New email:
PHP Version: OS:

 

 [2006-09-18 22:22 UTC] lagemann at x-wars dot net
Description:
------------
I set a static class var to $_SESSION ($varname 
= 'SESSION'; self::$$varname = $_SESSION;) and after some 
method calls and requires no new variable can be set in a 
method of the class.

This problem occurs not if i set self::$$varname = 
&$_SESSION;

tested with php 5.1.4, 5.1.6 and php 5.2.0RC5-dev 
(php5.2-200609172030)

Reproduce code:
---------------
Some more lines than 20:

http://degola.de/phpbug/

Expected result:
----------------
in line 41 the variable $classArray have to be Array ()

Actual result:
--------------
no new variable can be set, see http://degola.de/phpbug/

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-18 23:40 UTC] judas dot iscariote at gmail dot com
yu cannot do this :

$var = $_SESSION;

or 

$_SESSION = array(1,2,3,4,5);

because $_SESSION loose it's "magical" atributes then. and that is, the expected behaviuor.
 [2006-09-19 06:17 UTC] tony2001@php.net
.

 [2006-09-19 20:10 UTC] lagemann at x-wars dot net
Hm, i think its not really a good behaviour that i after 
some calls can't use new variables in methods. Perhaps it 
could be a better way to throw an exception, warning or 
error if I'm trying to assign the magic then 
doing "nothing" :-).
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 08:00:02 2026 UTC