cvs: pear /HTTP_Session2/HTTP Session2.php

From: Date: Tue, 11 Dec 2007 16:52:22 +0000
Subject: cvs: pear /HTTP_Session2/HTTP Session2.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-49719@lists.php.net to get a copy of this message
till Tue Dec 11 16:52:22 2007 UTC Modified files: /pear/HTTP_Session2/HTTP Session2.php Log: * replaced PEAR_Exception with HTTP_Session2_Exception * added ERR_ constants (for Exception codes) * added an additional test for ini_set() http://cvs.php.net/viewvc.cgi/pear/HTTP_Session2/HTTP/Session2.php?r1=1.11&r2=1.12&diff_format=u Index: pear/HTTP_Session2/HTTP/Session2.php diff -u pear/HTTP_Session2/HTTP/Session2.php:1.11 pear/HTTP_Session2/HTTP/Session2.php:1.12 --- pear/HTTP_Session2/HTTP/Session2.php:1.11 Tue Dec 11 09:47:46 2007 +++ pear/HTTP_Session2/HTTP/Session2.php Tue Dec 11 16:52:22 2007 @@ -40,7 +40,7 @@ * @author Alexander Radivaniovich <info@wwwlab.net> * @author Tony Bibbs <tony@geeklog.net> * @license http://www.php.net/license/3_01.txt The PHP License - * @version CVS: $Id: Session2.php,v 1.11 2007/12/11 09:47:46 till Exp $ + * @version CVS: $Id: Session2.php,v 1.12 2007/12/11 16:52:22 till Exp $ * @link http://pear.php.net/package/HTTP_Session2 */ @@ -120,6 +120,16 @@ */ const CONTINUED = 2; + /** + * @const ERR_UNKNOWN_CONTAINER - Container not found. + */ + const ERR_UNKNOWN_CONTAINER = 667; + + /** + * @const ERR_SYSTEM_PERM - System permissions not sufficient. + * E.g. Not enough permissions to override ini-settings. + */ + const ERR_SYSTEM_PERM = 668; /** * Sets user-defined session storage functions @@ -143,9 +153,9 @@ include_once $container_classfile; if (!class_exists($container_class)) { - throw new PEAR_Exception( - "Container class, $container_class, does not exist" - ); + throw new HTTP_Session2_Exception( + "Container class, $container_class, does not exist", + self::ERR_UNKNOWN_CONTAINER); } $container = new $container_class($container_options); @@ -425,14 +435,19 @@ public static function useCookies($useCookies = null) { $return = false; - if (ini_get('session.use_cookies')) { + if (ini_get('session.use_cookies') == '1') { $return = true; } if ($useCookies != null) { if ($useCookies) { - ini_set('session.use_cookies', 1); + $status = ini_set('session.use_cookies', 1); } else { - ini_set('session.use_cookies', 0); + $status = ini_set('session.use_cookies', 0); + } + if ($status === false) { + throw new HTTP_Session2_Exception( + 'Could not set session.use_cookies, please check permissions.', + self::ERR_SYSTEM_PERM); } } return $return;

« previous php.pear.cvs (#49719) next »