Re: PHP user session handlers
| From: | Glenn Richmond | Date: | Wed, 25 Oct 2006 09:35:56 +0000 |
| Subject: | Re: PHP user session handlers | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-26245@lists.php.net to get a copy of this message | ||
Done, I've just tested on PHP Version 5.2.0RC7-dev (today's snapshot)
and get the same result. The code is:
session_start();
$_SESSION['testing'] = $contents;
session_write_close();
unset($_SESSION['testing']);
session_start();
$newcontents = $_SESSION['testing'];
session_write_close();
There is a php file prepended to all code executions that sets up the
custom handler and it works for the first session_start, but on the
second call to session_start, I get:
*Fatal error*: session_start() [<a
href='function.session-start'>function.session-start</a>]: Failed to
initialize storage module: user (path: /tmp/php_sessions)
i.e. It still knows that it's a custom defined handler, but the
references to the functions are gone. If I make a call to
session_set_save_handler after the first session_write_close, the
problem goes away. Of course, this isn't practical for a large number of
sites.
Glenn.
Antony Dovgal wrote:
> On 10/25/2006 01:04 PM, Glenn Richmond wrote:
>> Hi guys,
>>
>> Just wondering what the status of the user-defined session handlers is?
>
> I don't think it makes any sense to ask such questions on the list,
> for the answer in most cases is "they are doing fine, thank you".
> Just grab the latest snapshot, test it and report any issues you see.
>
>> I've tested with 5.2rc4 and there is an issue that the references to the
>> user functions get erased when the user calls session_write_close or
>> session_destroy. This means that the system reverts to an alternative
>> handler.
>>
>> Any idea if this issue has been resolved or if not, how it could be
>> resolved? It basically makes large-scale user-defined session handlers
>> impossible (for general website handling). It has been discussed
>> previously, but no solution has been proposed as of yet.
>