Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29449 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31690 invoked by uid 1010); 15 May 2007 18:56:53 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 31675 invoked from network); 15 May 2007 18:56:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 May 2007 18:56:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=arpad@rajeczy.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=arpad@rajeczy.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain rajeczy.com from 195.188.213.5 cause and error) X-PHP-List-Original-Sender: arpad@rajeczy.com X-Host-Fingerprint: 195.188.213.5 smtp-out2.blueyonder.co.uk Linux 2.5 (sometimes 2.4) (4) Received: from [195.188.213.5] ([195.188.213.5:32865] helo=smtp-out2.blueyonder.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/1C-39652-2720A464 for ; Tue, 15 May 2007 14:56:52 -0400 Received: from [172.23.170.145] (helo=anti-virus03-08) by smtp-out2.blueyonder.co.uk with smtp (Exim 4.52) id 1Ho2CV-0003Vq-Q5; Tue, 15 May 2007 19:56:47 +0100 Received: from [62.31.45.208] (helo=[192.168.0.132]) by asmtp-out2.blueyonder.co.uk with esmtp (Exim 4.52) id 1Ho23d-0000Hf-0e; Tue, 15 May 2007 19:47:37 +0100 Message-ID: <464A0049.50609@rajeczy.com> Date: Tue, 15 May 2007 19:47:37 +0100 User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: Emil Ivanov CC: internals@lists.php.net References: <38.B7.39652.C93F9464@pb1.pair.com> In-Reply-To: <38.B7.39652.C93F9464@pb1.pair.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] register_session_gc_handler proposal From: arpad@rajeczy.com (Arpad Ray) Emil Ivanov wrote: > The case is simple: > A user is allowed to upload files to the server, which are store in a > temporary location and their filenames are stored in the session. > The user leaves the site and the session gets destroyed, but the files > remain untouched. > If I can hook to the gc session function that will solve my case, but > currently with session_set_save_handler I have to rewrite session handling, > which I don't need... > So a simple hook will be very useful. Hi, I've also been looking into how this could be implemented elegantly and I'd like to propose the following: - Create a class exposed to userland called something like SessionDefaultHandler, which wraps the session module defined at startup. - Alter session_set_save_handler() to alternatively take a single argument, a class name. - The given handler class must extend SessionDefaultHandler and may override any of its methods. - Alter the user session module to use the child class if it's been registered. This would provide an elegant solution to your particular problem, as well as allowing any default session functions to be overridden, wrapped or called independently. $maxlifetime) { unlink($file); } } return true; } } session_set_save_handler('MySessionHandler'); ?> Any thoughts? Arpad