Re: [PHP-DEV] $_SESSION questions

2003-10-11 Thread Sascha Schumann
On Sat, 10 Oct 2003, Jeremy Johnstone wrote:

 I have recently found that if I don't register a session using PHP's
 session management code I can use the $_SESSION variable as my own
 superglobal which I can use for whatever purpose I deam fit. Here is a
 small code snippet to illustrate:

Such use is not officially supported.  You are specifically
relying on a feature the session module is enabling for you
(registration of automatic global).

- Sascha

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] $_SESSION questions

2003-10-10 Thread Jeremy Johnstone
I have recently found that if I don't register a session using PHP's
session management code I can use the $_SESSION variable as my own
superglobal which I can use for whatever purpose I deam fit. Here is a
small code snippet to illustrate:

$_SESSION = new my_custom_session_obj();

function test_session() {
   print($_SESSION-loginvars[username]);
}

test_session();

Works fine. Of course there is no autosaving of the session as PHP
normally does, but this is fine as I already have code to do this. My
question is this a bug or a feature. I don't want to use this code
if it is not an officially supported usage as it would obviously not be
very backwards compatible and also not useable in new versions of PHP.
If anyone can tell me approximately when this started to work (have
tested in several 4.3.x builds already) and if it's expected to work in
the future I would greatly appreciate it.

Jeremy

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php