Re: Sessions and multiple windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 07 December 2004 20:50, Rory McKinley wrote:


> User clicks through to page_3.php from page_2.php.
>
> Page_3.php starts, unserializes $_SESSION['policeman'], and begins a
> lengthy SQL query that will take a few minutes to complete.

When Page_3.php does its business it will have locked the session data file 
and only that instance of Page_3.php will have access to it. It will 
automatically release the lock when the page finishes executing or when you 
explicitly issue a session_write_close().

> The user wants to do something else so he\she opens a new window for
> page_9.php (at this point page_3.php has yet to complete).
>
> Now, the question is, what will PHP do when it starts with page_9?

As Page_3.php is still doing its business the session data file is locked and 
when page_9.php tries to session_start() and finds it has no access to it 
will suspend execution until the lock is relinquished by Page_3.php.

> Will
> it unserialize $_SESSION['policeman'] again, 

Yes ...

> even though it already has 
> an unserialized instance of $_SESSION['policeman']?

... because by the time it has access to the session data that unserialized 
instance of $_SESSION['policeman'] has already gone ...

> If it does 
> unserialize, does that mean that it creates a second instance of
> $_SESSION['policeman'], thereby breaking the common link that I am
> trying to provide?

Only one instance of $_SESSION['policeman'] can be in existence for a 
particular session_id.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
<rcw> liiwi: printk("CPU0 on fire
");
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux