Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71543 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21416 invoked from network); 25 Jan 2014 01:57:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jan 2014 01:57:10 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.153 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.153 smtp153.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.153] ([67.192.241.153:60884] helo=smtp153.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6D/D1-11879-6F913E25 for ; Fri, 24 Jan 2014 20:57:10 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp5.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 0707858A0F; Fri, 24 Jan 2014 20:57:07 -0500 (EST) X-Virus-Scanned: OK Received: by smtp5.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id B0BB958863; Fri, 24 Jan 2014 20:57:06 -0500 (EST) Message-ID: <52E319F2.8080705@sugarcrm.com> Date: Fri, 24 Jan 2014 17:57:06 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Andrey Andreev , "internals@lists.php.net" References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Session IP address matching From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > I'm not aware of a way to override just read(). What would be the problem with it? You can override each method independently. > But even even if I could, how would I avoid breaking the rest of the > SessionHandler? The manual implies that read() is where (in userland PHP > terms) fopen() + assign file handle + flock() would happen. Why would you break it? Just do something like: class SessionHandlerWithIPChecks extends SessionHandler { public function SessionHandler::read($session_id) { $data = parent::read($session_id); if(!$this->doChecks($data)) { return ""; } return $data; } } Then do: session_set_save_handler(new SessionHandlerWithIPChecks()); -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227