diff --git a/src/Configuration/ConfigurationInterface.php b/src/Configuration/ConfigurationInterface.php index 84061a70..3161a910 100644 --- a/src/Configuration/ConfigurationInterface.php +++ b/src/Configuration/ConfigurationInterface.php @@ -50,7 +50,7 @@ public function setCookieDomain($cookieDomain); public function getCookieDomain(); public function setCookieSecure($cookieSecure); public function getCookieSecure(); - public function setCookieHttpOnly($cookieHTTPOnly); + public function setCookieHttpOnly($cookieHttpOnly); public function getCookieHttpOnly(); public function setUseCookies($useCookies); public function getUseCookies(); diff --git a/src/Configuration/SessionConfiguration.php b/src/Configuration/SessionConfiguration.php index 219091e5..5512d282 100644 --- a/src/Configuration/SessionConfiguration.php +++ b/src/Configuration/SessionConfiguration.php @@ -24,7 +24,7 @@ Zend\Session\Exception; /** - * Session configuration proxying to session INI options + * Session configuration proxying to session INI options * * @category Zend * @package Zend_Session @@ -83,11 +83,11 @@ class SessionConfiguration extends StandardConfiguration /** * Set storage option in backend configuration store * - * Does nothing in this implementation; others might use it to set things + * Does nothing in this implementation; others might use it to set things * such as INI settings. - * - * @param string $storageName - * @param mixed $storageValue + * + * @param string $storageName + * @param mixed $storageValue * @return SessionConfiguration */ public function setStorageOption($storageName, $storageValue) @@ -113,7 +113,7 @@ public function setStorageOption($storageName, $storageValue) * Retrieve a storage option from a backend configuration store * * Used to retrieve default values from a backend configuration store. - * + * * @param string $storageOption * @return mixed */ @@ -133,6 +133,7 @@ public function getStorageOption($storageOption) case 'use_cookies': case 'use_only_cookies': case 'use_trans_sid': + case 'cookie_httponly': $transform = function ($value) { return (bool) $value; }; @@ -150,9 +151,9 @@ public function getStorageOption($storageOption) /** * Handle PHP errors - * - * @param int $code - * @param string $message + * + * @param int $code + * @param string $message * @return void */ protected function handleError($code, $message) @@ -163,8 +164,8 @@ protected function handleError($code, $message) /** * Set session.save_handler - * - * @param string $phpSaveHandler + * + * @param string $phpSaveHandler * @return SessionConfiguration * @throws Exception\InvalidArgumentException */ @@ -184,8 +185,8 @@ public function setPhpSaveHandler($phpSaveHandler) /** * Set session.serialize_handler - * - * @param string $serializeHandler + * + * @param string $serializeHandler * @return SessionConfiguration * @throws Exception\InvalidArgumentException */ @@ -223,10 +224,10 @@ public function setCacheLimiter($cacheLimiter) ini_set('session.cache_limiter', $cacheLimiter); return $this; } - + /** * Retrieve list of valid hash functions - * + * * @return array */ protected function getHashFunctions() @@ -234,7 +235,7 @@ protected function getHashFunctions() if (empty($this->validHashFunctions)) { /** * @see http://php.net/manual/en/session.configuration.php#ini.session.hash-function - * "0" and "1" refer to MD5-128 and SHA1-160, respectively, and are + * "0" and "1" refer to MD5-128 and SHA1-160, respectively, and are * valid in addition to whatever is reported by hash_algos() */ $this->validHashFunctions = array('0', '1') + hash_algos(); @@ -244,8 +245,8 @@ protected function getHashFunctions() /** * Set session.hash_function - * - * @param string|int $hashFunction + * + * @param string|int $hashFunction * @return SessionConfiguration * @throws Exception\InvalidArgumentException */ @@ -264,8 +265,8 @@ public function setHashFunction($hashFunction) /** * Set session.hash_bits_per_character - * - * @param int $hashBitsPerCharacter + * + * @param int $hashBitsPerCharacter * @return SessionConfiguration * @throws Exception\InvalidArgumentException */ diff --git a/src/Configuration/StandardConfiguration.php b/src/Configuration/StandardConfiguration.php index 982422d9..208bc11c 100644 --- a/src/Configuration/StandardConfiguration.php +++ b/src/Configuration/StandardConfiguration.php @@ -40,7 +40,7 @@ class StandardConfiguration implements Configurable * @var Zend\Filter Filter to convert CamelCase to underscore_separated */ protected $camelCaseToUnderscoreFilter; - + /** * @var string session.cookie_domain */ @@ -49,7 +49,7 @@ class StandardConfiguration implements Configurable /** * @var bool session.cookie_httponly */ - protected $cookieHTTPOnly; + protected $cookieHttpOnly; /** * @var int session.cookie_lifetime @@ -94,11 +94,11 @@ class StandardConfiguration implements Configurable /** * Set storage option in backend configuration store * - * Does nothing in this implementation; others might use it to set things + * Does nothing in this implementation; others might use it to set things * such as INI settings. - * - * @param string $storageName - * @param mixed $storageValue + * + * @param string $storageName + * @param mixed $storageValue * @return StandardConfiguration */ public function setStorageOption($storageName, $storageValue) @@ -109,7 +109,7 @@ public function setStorageOption($storageName, $storageValue) * Retrieve a storage option from a backend configuration store * * Used to retrieve default values from a backend configuration store. - * + * * @param string $storageOption * @return mixed */ @@ -120,8 +120,8 @@ public function getStorageOption($storageOption) /** * Set session.save_path - * - * @param string $savePath + * + * @param string $savePath * @return StandardConfiguration * @throws Exception\InvalidArgumentException on invalid path */ @@ -137,7 +137,7 @@ public function setSavePath($savePath) /** * Set session.save_path - * + * * @return string|null */ public function getSavePath() @@ -150,8 +150,8 @@ public function getSavePath() /** * Set session.name - * - * @param string $name + * + * @param string $name * @return StandardConfiguration * @throws Exception\InvalidArgumentException */ @@ -167,7 +167,7 @@ public function setName($name) /** * Get session.name - * + * * @return null|string */ public function getName() @@ -177,11 +177,11 @@ public function getName() } return $this->name; } - + /** * Set session.gc_probability - * - * @param int $gcProbability + * + * @param int $gcProbability * @return StandardConfiguration * @throws Exception\InvalidArgumentException */ @@ -201,8 +201,8 @@ public function setGcProbability($gcProbability) /** * Set session.gc_divisor - * - * @param int $gcDivisor + * + * @param int $gcDivisor * @return StandardConfiguration * @throws Exception\InvalidArgumentException */ @@ -222,8 +222,8 @@ public function setGcDivisor($gcDivisor) /** * Set gc.maxlifetime - * - * @param int $gcMaxlifetime + * + * @param int $gcMaxlifetime * @return StandardConfiguration * @throws Exception\InvalidArgumentException */ @@ -245,8 +245,8 @@ public function setGcMaxlifetime($gcMaxlifetime) /** * Set session.cookie_lifetime - * - * @param int $cookieLifetime + * + * @param int $cookieLifetime * @return StandardConfiguration * @throws Exception\InvalidArgumentException */ @@ -266,7 +266,7 @@ public function setCookieLifetime($cookieLifetime) /** * Get session.cookie_lifetime - * + * * @return int */ public function getCookieLifetime() @@ -276,11 +276,11 @@ public function getCookieLifetime() } return $this->cookieLifetime; } - + /** * Set session.cookie_path - * - * @param string $cookiePath + * + * @param string $cookiePath * @return StandardConfiguration * @throws Exception\InvalidArgumentException */ @@ -300,7 +300,7 @@ public function setCookiePath($cookiePath) /** * Get session.cookie_path - * + * * @return string */ public function getCookiePath() @@ -310,11 +310,11 @@ public function getCookiePath() } return $this->cookiePath; } - + /** * Set session.cookie_domain - * - * @param string $cookieDomain + * + * @param string $cookieDomain * @return StandardConfiguration * @throws Exception\InvalidArgumentException */ @@ -337,7 +337,7 @@ public function setCookieDomain($cookieDomain) /** * Get session.cookie_domain - * + * * @return string */ public function getCookieDomain() @@ -347,11 +347,11 @@ public function getCookieDomain() } return $this->cookieDomain; } - + /** * Set session.cookie_secure - * - * @param bool $cookieSecure + * + * @param bool $cookieSecure * @return StandardConfiguration */ public function setCookieSecure($cookieSecure) @@ -363,7 +363,7 @@ public function setCookieSecure($cookieSecure) /** * Get session.cookie_secure - * + * * @return bool */ public function getCookieSecure() @@ -373,39 +373,39 @@ public function getCookieSecure() } return $this->cookieSecure; } - + /** * Set session.cookie_httponly * - * case sensitive method lookups in setOptions means this method has an + * case sensitive method lookups in setOptions means this method has an * unusual casing * - * @param bool $cookieHTTPOnly + * @param bool $cookieHttpOnly * @return StandardConfiguration */ - public function setCookieHttponly($cookieHTTPOnly) + public function setCookieHttpOnly($cookieHttpOnly) { - $this->cookieHTTPOnly = (bool) $cookieHTTPOnly; - $this->setStorageOption('cookie_httponly', $this->cookieHTTPOnly); + $this->cookieHttpOnly = (bool) $cookieHttpOnly; + $this->setStorageOption('cookie_httponly', $this->cookieHttpOnly); return $this; } /** * Get session.cookie_httponly - * + * * @return bool */ - public function getCookieHTTPOnly() + public function getCookieHttpOnly() { - if (null === $this->cookieHTTPOnly) { - $this->cookieHTTPOnly = $this->getStorageOption('cookie_httponly'); + if (null === $this->cookieHttpOnly) { + $this->cookieHttpOnly = $this->getStorageOption('cookie_httponly'); } - return $this->cookieHTTPOnly; + return $this->cookieHttpOnly; } - + /** * Set session.use_cookies - * + * * @param bool $useCookies * @return StandardConfiguration */ @@ -418,7 +418,7 @@ public function setUseCookies($useCookies) /** * Get session.use_cookies - * + * * @return bool */ public function getUseCookies() @@ -428,10 +428,10 @@ public function getUseCookies() } return $this->useCookies; } - + /** * Set session.entropy_file - * + * * @param string $entropyFile * @return StandardConfiguration * @throws Exception\InvalidArgumentException @@ -448,8 +448,8 @@ public function setEntropyFile($entropyFile) /** * set session.entropy_length - * - * @param int $entropyLength + * + * @param int $entropyLength * @return StandardConfiguration * @throws Exception\InvalidArgumentException */ @@ -469,8 +469,8 @@ public function setEntropyLength($entropyLength) /** * Set session.cache_expire - * - * @param int $cacheExpire + * + * @param int $cacheExpire * @return StandardConfiguration * @throws Exception\InvalidArgumentException */ @@ -492,8 +492,8 @@ public function setCacheExpire($cacheExpire) /** * Set session.hash_bits_per_character - * - * @param int $hashBitsPerCharacter + * + * @param int $hashBitsPerCharacter * @return StandardConfiguration * @throws Exception\InvalidArgumentException */ @@ -510,8 +510,8 @@ public function setHashBitsPerCharacter($hashBitsPerCharacter) /** * Set remember_me_seconds - * - * @param int $rememberMeSeconds + * + * @param int $rememberMeSeconds * @return StandardConfiguration * @throws Exception\InvalidArgumentException */ @@ -533,7 +533,7 @@ public function setRememberMeSeconds($rememberMeSeconds) /** * Get remember_me_seconds - * + * * @return int */ public function getRememberMeSeconds() @@ -543,25 +543,24 @@ public function getRememberMeSeconds() } return $this->rememberMeSeconds; } - + /** * Set many options at once * - * If a setter method exists for the key, that method will be called; - * otherwise, a standard option will be set with the value provided via + * If a setter method exists for the key, that method will be called; + * otherwise, a standard option will be set with the value provided via * {@link setOption()}. - * - * @param array $options + * + * @param array $options * @return StandardConfiguration */ public function setOptions(array $options) { - $methods = get_class_methods($this); foreach ($options as $key => $value) { // translate key from underscore_separated to TitleCased $methodKey = str_replace(' ', '', ucwords(str_replace('_', ' ', $key))); $method = 'set' . $methodKey; - if (in_array($method, $methods)) { + if (method_exists($this, $method)) { $this->$method($value); } else { $this->setOption($key, $value); @@ -575,10 +574,10 @@ public function setOptions(array $options) * * Keys are normalized to lowercase. After setting internally, calls * {@link setStorageOption()} to allow further processing. - * - * - * @param string $option - * @param mixed $value + * + * + * @param string $option + * @param mixed $value * @return StandardConfiguration */ public function setOption($option, $value) @@ -592,13 +591,13 @@ public function setOption($option, $value) /** * Get an individual option * - * Keys are normalized to lowercase. If the option is not found, attempts + * Keys are normalized to lowercase. If the option is not found, attempts * to retrieve it via {@link getStorageOption()}; if a value is returned * from that method, it will be set as the internal value and returned. * * Returns null for unfound options - * - * @param string $option + * + * @param string $option * @return mixed */ public function getOption($option) @@ -619,8 +618,8 @@ public function getOption($option) /** * Check to see if an internal option has been set for the key provided. - * - * @param string $option + * + * @param string $option * @return bool */ public function hasOption($option) @@ -631,7 +630,7 @@ public function hasOption($option) /** * Cast configuration to an array - * + * * @return array */ public function toArray() @@ -639,7 +638,7 @@ public function toArray() $options = $this->options; $extraOpts = array( 'cookie_domain' => $this->getCookieDomain(), - 'cookie_httponly' => $this->getCookieHTTPOnly(), + 'cookie_httponly' => $this->getCookieHttpOnly(), 'cookie_lifetime' => $this->getCookieLifetime(), 'cookie_path' => $this->getCookiePath(), 'cookie_secure' => $this->getCookieSecure(), @@ -654,11 +653,11 @@ public function toArray() /** * Intercept get*() and set*() methods * - * Intercepts getters and setters and passes them to getOption() and setOption(), + * Intercepts getters and setters and passes them to getOption() and setOption(), * respectively. - * - * @param string $method - * @param array $args + * + * @param string $method + * @param array $args * @return mixed * @throws Exception\BadMethodCallException on non-getter/setter method */ @@ -684,8 +683,8 @@ public function __call($method, $args) /** * Normalize an option name to lowercase - * - * @param string $option + * + * @param string $option * @return string */ protected function normalizeOption($option) @@ -695,7 +694,7 @@ protected function normalizeOption($option) /** * Retrieve the CamelCaseToUnderscoreFilter - * + * * @return CamelCaseToUnderscoreFilter */ protected function getCamelCaseToUnderscoreFilter() diff --git a/src/SaveHandler/Cache.php b/src/SaveHandler/Cache.php index cb94f9a7..cab7a6b4 100644 --- a/src/SaveHandler/Cache.php +++ b/src/SaveHandler/Cache.php @@ -20,8 +20,11 @@ namespace Zend\Session\SaveHandler; -use Zend\Cache\Storage\Adapter\AdapterInterface as StorageAdapter; -use Zend\Session\Exception; +use Zend\Cache\Storage\ClearExpiredInterface; + +use Zend\Cache\Storage\StorageInterface as CacheStorage, + Zend\Cache\Storage\ClearExpiredInterface as ClearExpiredCacheStorage, + Zend\Session\Exception; /** * Cache session save handler @@ -49,21 +52,21 @@ class Cache implements SaveHandlerInterface protected $sessionName; /** - * The cache storage adapter - * @var StorageAdapter + * The cache storage + * @var CacheStorage */ - protected $storageAdapter; + protected $cacheStorage; /** * Constructor * - * @param Zend\Cache\Storage\Adapter\AdapterInterface $storageAdapter + * @param CacheStorage $cacheStorage * @return void - * @throws Zend\Session\Exception\ExceptionInterface + * @throws Exception\ExceptionInterface */ - public function __construct(StorageAdapter $storageAdapter) + public function __construct(CacheStorage $cacheStorage) { - $this->setStorageAdapter($storageAdapter); + $this->setCacheStorage($cacheStorage); } /** @@ -100,7 +103,7 @@ public function close() */ public function read($id) { - return $this->getStorageAdapter()->getItem($id); + return $this->getCacheStorge()->getItem($id); } /** @@ -112,7 +115,7 @@ public function read($id) */ public function write($id, $data) { - return $this->getStorageAdapter()->setItem($id, $data); + return $this->getCacheStorge()->setItem($id, $data); } /** @@ -123,40 +126,42 @@ public function write($id, $data) */ public function destroy($id) { - return $this->getStorageAdapter()->removeItem($id); + return $this->getCacheStorge()->removeItem($id); } /** * Garbage Collection * * @param int $maxlifetime - * @return true + * @return boolean */ public function gc($maxlifetime) { + $cache = $this->getCacheStorge(); + if ($cache instanceof ClearExpiredCacheStorage) { + return $cache->clearExpired(); + } return true; } /** - * Set cache storage adapter - * - * Allows passing a string class name or StorageAdapter object. + * Set cache storage * - * @param Zend\Cache\Storage\Adapter\AdapterInterface + * @param CacheStorage * @return void */ - public function setStorageAdapter(StorageAdapter $storageAdapter) + public function setCacheStorage(CacheStorage $cacheStorage) { - $this->storageAdapter = $storageAdapter; + $this->cacheStorage = $cacheStorage; } /** * Get Cache Storage Adapter Object * - * @return Zend\Cache\Storage\Adapter\AdapterInterface + * @return CacheStorage */ - public function getStorageAdapter() + public function getCacheStorge() { - return $this->storageAdapter; + return $this->cacheStorage; } } diff --git a/src/SessionManager.php b/src/SessionManager.php index e43847e6..2f69757f 100644 --- a/src/SessionManager.php +++ b/src/SessionManager.php @@ -57,7 +57,7 @@ class SessionManager extends AbstractManager /** * Does a session exist and is it currently active? - * + * * @return bool */ public function sessionExists() @@ -79,7 +79,7 @@ public function sessionExists() * {@link isValid()} once session_start() is called, and raises an * exception if validation fails. * - * @param bool $preserveStorage If set to true, current session storage will not be overwritten by the + * @param bool $preserveStorage If set to true, current session storage will not be overwritten by the * contents of $_SESSION. * @return void * @throws Exception\RuntimeException @@ -102,7 +102,7 @@ public function start($preserveStorage = false) } $storage = $this->getStorage(); - // Since session is starting, we need to potentially repopulate our + // Since session is starting, we need to potentially repopulate our // session storage if ($storage instanceof Storage\SessionStorage && $_SESSION !== $storage @@ -116,7 +116,7 @@ public function start($preserveStorage = false) /** * Destroy/end a session - * + * * @param array $options See {@link $defaultDestroyOptions} * @return void */ @@ -146,21 +146,21 @@ public function destroy(array $options = null) * Write session to save handler and close * * Once done, the Storage object will be marked as immutable. - * + * * @return void */ public function writeClose() { // The assumption is that we're using PHP's ext/session. - // session_write_close() will actually overwrite $_SESSION with an + // session_write_close() will actually overwrite $_SESSION with an // empty array on completion -- which leads to a mismatch between what // is in the storage object and $_SESSION. To get around this, we - // temporarily reset $_SESSION to an array, and then re-link it to + // temporarily reset $_SESSION to an array, and then re-link it to // the storage object. // - // Additionally, while you _can_ write to $_SESSION following a - // session_write_close() operation, no changes made to it will be - // flushed to the session handler. As such, we now mark the storage + // Additionally, while you _can_ write to $_SESSION following a + // session_write_close() operation, no changes made to it will be + // flushed to the session handler. As such, we now mark the storage // object immutable. $storage = $this->getStorage(); $_SESSION = (array) $storage; @@ -173,13 +173,13 @@ public function writeClose() * Get session name * * Proxies to {@link session_name()}. - * + * * @return string */ public function getName() { if (null === $this->name) { - // If we're grabbing via session_name(), we don't need our + // If we're grabbing via session_name(), we don't need our // validation routine; additionally, calling setName() after // session_start() can lead to issues, and often we just need the name // in order to do things such as setting cookies. @@ -191,10 +191,10 @@ public function getName() /** * Attempt to set the session name * - * If the session has already been started, or if the name provided fails + * If the session has already been started, or if the name provided fails * validation, an exception will be raised. - * - * @param string $name + * + * @param string $name * @return SessionManager * @throws Exception\InvalidArgumentException */ @@ -218,7 +218,7 @@ public function setName($name) * Get session ID * * Proxies to {@link session_id()} - * + * * @return string */ public function getId() @@ -230,8 +230,8 @@ public function getId() * Set session ID * * Can safely be called in the middle of a session. - * - * @param string $id + * + * @param string $id * @return SessionManager */ public function setId($id) @@ -249,7 +249,7 @@ public function setId($id) /** * Regenerate id * - * Regenerate the session ID, using session save handler's + * Regenerate the session ID, using session save handler's * native ID generation Can safely be called in the middle of a session. * * @param bool $deleteOldSession @@ -271,7 +271,7 @@ public function regenerateId($deleteOldSession = true) * * Can safely be called in the middle of a session. * - * @param null|int $ttl + * @param null|int $ttl * @return SessionManager */ public function rememberMe($ttl = null) @@ -287,7 +287,7 @@ public function rememberMe($ttl = null) * Set a 0s TTL for the session cookie * * Can safely be called in the middle of a session. - * + * * @return SessionManager */ public function forgetMe() @@ -300,7 +300,7 @@ public function forgetMe() * Set the validator chain to use when validating a session * * In most cases, you should use an instance of {@link ValidatorChain}. - * + * * @param EventManagerInterface $chain * @return SessionManager */ @@ -314,7 +314,7 @@ public function setValidatorChain(EventManagerInterface $chain) * Get the validator chain to use when validating a session * * By default, uses an instance of {@link ValidatorChain}. - * + * * @return void */ public function getValidatorChain() @@ -328,9 +328,9 @@ public function getValidatorChain() /** * Is this session valid? * - * Notifies the Validator Chain until either all validators have returned + * Notifies the Validator Chain until either all validators have returned * true or one has failed. - * + * * @return bool */ public function isValid() @@ -351,7 +351,7 @@ public function isValid() * Expire the session cookie * * Sends a session cookie with no value, and with an expiry in the past. - * + * * @return void */ public function expireSessionCookie() @@ -366,18 +366,18 @@ public function expireSessionCookie() $_SERVER['REQUEST_TIME'] - 42000, // TTL for cookie $config->getCookiePath(), $config->getCookieDomain(), - $config->getCookieSecure(), - $config->getCookieHTTPOnly() + $config->getCookieSecure(), + $config->getCookieHttpOnly() ); } /** * Set the session cookie lifetime * - * If a session already exists, destroys it (without sending an expiration + * If a session already exists, destroys it (without sending an expiration * cookie), regenerates the session ID, and restarts the session. * - * @param int $ttl + * @param int $ttl * @return void */ protected function setSessionCookieLifetime($ttl) diff --git a/src/Storage/ArrayStorage.php b/src/Storage/ArrayStorage.php index 32ff21c1..45953da1 100644 --- a/src/Storage/ArrayStorage.php +++ b/src/Storage/ArrayStorage.php @@ -226,14 +226,6 @@ public function setMetadata($key, $value, $overwriteArray = false) if (isset($this['__ZF'][$key]) && is_array($value)) { if ($overwriteArray) { $this['__ZF'][$key] = $value; - } elseif (null === $value) { - // unset($this['__ZF'][$key]) led to "indirect modification... - // has no effect" errors, so explicitly pulling array and - // unsetting key. - $array = $this['__ZF']; - unset($array[$key]); - $this['__ZF'] = $array; - unset($array); } else { $this['__ZF'][$key] = array_replace_recursive($this['__ZF'][$key], $value); } @@ -250,6 +242,7 @@ public function setMetadata($key, $value, $overwriteArray = false) $this['__ZF'][$key] = $value; } } + return $this; } diff --git a/test/SessionConfigurationTest.php b/test/SessionConfigurationTest.php index c9e4e335..9fb54a30 100644 --- a/test/SessionConfigurationTest.php +++ b/test/SessionConfigurationTest.php @@ -133,7 +133,7 @@ public function testSettingInvalidGcProbabilityRaisesException() $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid gc_probability; must be numeric'); $this->config->setGcProbability('foobar_bogus'); } - + public function testSettingInvalidGcProbabilityRaisesException2() { $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid gc_probability; must be a percentage'); @@ -170,7 +170,7 @@ public function testSettingInvalidGcDivisorRaisesException() $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid gc_divisor; must be numeric'); $this->config->setGcDivisor('foobar_bogus'); } - + public function testSettingInvalidGcDivisorRaisesException2() { $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid gc_divisor; must be a positive integer'); @@ -201,7 +201,7 @@ public function testSettingInvalidGcMaxlifetimeRaisesException() $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid gc_maxlifetime; must be numeric'); $this->config->setGcMaxlifetime('foobar_bogus'); } - + public function testSettingInvalidGcMaxlifetimeRaisesException2() { $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid gc_maxlifetime; must be a positive integer'); @@ -265,9 +265,9 @@ public function testSettingInvalidCookieLifetimeRaisesException() $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid cookie_lifetime; must be numeric'); $this->config->setCookieLifetime('foobar_bogus'); } - + public function testSettingInvalidCookieLifetimeRaisesException2() - { + { $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid cookie_lifetime; must be a positive integer or zero'); $this->config->setCookieLifetime(-1); } @@ -296,7 +296,7 @@ public function testSettingInvalidCookiePathRaisesException() $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid cookie path'); $this->config->setCookiePath(24); } - + public function testSettingInvalidCookiePathRaisesException2() { $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid cookie path'); @@ -339,7 +339,7 @@ public function testSettingInvalidCookieDomainRaisesException() $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid cookie domain: must be a string'); $this->config->setCookieDomain(24); } - + public function testSettingInvalidCookieDomainRaisesException2() { $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'does not match the expected structure for a DNS hostname'); @@ -371,7 +371,7 @@ public function testCookieSecureAltersIniSetting() public function testCookieHttpOnlyDefaultsToIniSettings() { - $this->assertSame(ini_get('session.cookie_httponly'), $this->config->getCookieHttpOnly()); + $this->assertSame((bool) ini_get('session.cookie_httponly'), $this->config->getCookieHttpOnly()); } public function testCookieHttpOnlyIsMutable() @@ -516,7 +516,7 @@ public function testSettingInvalidEntropyLengthRaisesException() $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid entropy_length; must be numeric'); $this->config->setEntropyLength('foobar_bogus'); } - + public function testSettingInvalidEntropyLengthRaisesException2() { $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException', 'Invalid entropy_length; must be a positive integer or zero');