Warren Vail wrote:
> 
> When the session_register is executed the session contents are partially
> updated.
> Your first test actually executed the session_register that posted the
> variable with 0 string length, because the variable had not yet been
> initialized (the bad return is the only indication of this).

Ok.  I changed the script below to set the variable before
registering it and it makes no difference to the output.

 
> You can identify what actually happened by viewing the session file contents
> after your two pages are displayed.

I mentioned that already.  The file is empty.


Jennifer


> "Johnson, Kirk" wrote:
> >
> > > -----Original Message-----
> > > From: Jennifer [mailto:[EMAIL PROTECTED]]
> > > Do you need to register a variable with the session before you
> > > assign it a value?
> >
> > Not in my experience.
> >
> > > session_register should return true if the variable was
> > > successfully registered?
> >
> > It returns "1".
> >
> > > The variable name and it's value should be written to the file
> > > with the same name as session_id()?
> >
> > Yes, here's a sample from a session file: superUser|s:3:"Yes";
> > Here's a sample session filename: sess_01bc2e24aa5291300887948f0af74899
> 
> This is all what I thought, but I am still having problems and I
> don't have a clue what I am missing. Here's an example that I
> have been paying with for testing.
> 
> page1.php contains
> <?php
> session_start();
> echo "session id is ".session_id()."<br>\n";
> if (session_register("testing")) {
>     echo "session_register worked.<br>\n";
> }
> else {
>     echo "session_register did not work<br>\n";
> }
> if (session_is_registered("testing")) {
>     echo "testing is a registered variable<br>\n";
> }
> else {
>     echo "testing is not a registered variable<br>\n";
> }
> $testing = "Let's see if this works.";
> ?>
> <a href="page2.php?<?=SID?>">Go to next page.</a>
> 
> The output of the above page, gives me
> session id is e35c2893382e28a14fa0455302edb06e
> session_register did not work
> testing is a registered variable
> Go to next page.
> 
> and page2.php contains
> <?php
> session_start();
> echo "session id is ".session_id()."<br>\n";
> echo "Testing: $testing<br>\n";
> ?>
> 
> The output of page2 gives me
> session id is e35c2893382e28a14fa0455302edb06e
> Testing:
> 
> I am totally confused.  First off, why isn't it registering the
> variable? There is a file named e35c2893382e28a14fa0455302edb06e
> in my /tmp directory, but it is empty.
> 
> Second, if it isn't registering the variable then why is
> session_is_registered("testing") returning true?
> 
> Jennifer

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to