note 14946 deleted from function.session-start by jimw

From: Date: Fri, 07 Dec 2001 20:29:10 +0000
Subject: note 14946 deleted from function.session-start by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-21927@lists.php.net to get a copy of this message
[Editor's note: this is a known behavior for strings, and documented although deprecated. The author of this note did not read the appropriate section in the manual.] I have just found something that interests me. All thoughts and reasonings welcome. I am using a custom class in which I custom define the following function: session_set_save_handler( "sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc"); The reason for this class is so that I can store sessions and their data in a MySQL table. (which might I add appears to be VERY buggy). Now, when it came to bringing back the session variables to be able to echo them, the $PHPSESSID was passed using POST via a form. The following code was then used: <?php session_start(); echo ($session_variable); ?> But I then started playing around with it and ended up with: <?php session_start(); echo ($session_variable[2]); ?> And so begun echoing the variable as an array. For instance, if the variable $session_variable contained "12345" as a string, the previus code would print 3 (as if the variable was an array). This is probably of not much use to anybody, but when I made this discovery I just thought I should let people know.. and if anyone can offer any explanation as to why this happens. it will be welcomed. (are the vars stored in as an array?? ..news to me)

« previous php.notes (#21927) next »