Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 36 changed files with 197 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/AbstractManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Config/ConfigInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
12 changes: 7 additions & 5 deletions src/Config/SessionConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down Expand Up @@ -70,12 +70,10 @@ class SessionConfig extends StandardConfig
/**
* Set storage option in backend configuration store
*
* Does nothing in this implementation; others might use it to set things
* such as INI settings.
*
* @param string $storageName
* @param mixed $storageValue
* @return SessionConfig
* @throws \InvalidArgumentException
*/
public function setStorageOption($storageName, $storageValue)
{
Expand All @@ -92,7 +90,11 @@ public function setStorageOption($storageName, $storageValue)
break;
}

ini_set($key, $storageValue);
$result = ini_set($key, $storageValue);
if (FALSE === $result) {
throw new \InvalidArgumentException("'" . $key .
"' is not a valid sessions-related ini setting.");
}
return $this;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Config/StandardConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down Expand Up @@ -595,7 +595,7 @@ public function getUseCookies()
*/
public function setEntropyFile($entropyFile)
{
if (!is_file($entropyFile) || !is_readable($entropyFile)) {
if (!is_readable($entropyFile)) {
throw new Exception\InvalidArgumentException(sprintf(
"Invalid entropy_file provided: '%s'; doesn't exist or not readable",
$entropyFile
Expand Down
2 changes: 1 addition & 1 deletion src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
2 changes: 1 addition & 1 deletion src/ManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
32 changes: 20 additions & 12 deletions src/SaveHandler/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down Expand Up @@ -57,7 +57,7 @@ public function __construct(CacheStorage $cacheStorage)
*
* @param string $savePath
* @param string $name
* @return boolean
* @return bool
*/
public function open($savePath, $name)
{
Expand All @@ -71,7 +71,7 @@ public function open($savePath, $name)
/**
* Close session
*
* @return boolean
* @return bool
*/
public function close()
{
Expand All @@ -86,41 +86,41 @@ public function close()
*/
public function read($id)
{
return $this->getCacheStorge()->getItem($id);
return $this->getCacheStorage()->getItem($id);
}

/**
* Write session data
*
* @param string $id
* @param string $data
* @return boolean
* @return bool
*/
public function write($id, $data)
{
return $this->getCacheStorge()->setItem($id, $data);
return $this->getCacheStorage()->setItem($id, $data);
}

/**
* Destroy session
*
* @param string $id
* @return boolean
* @return bool
*/
public function destroy($id)
{
return $this->getCacheStorge()->removeItem($id);
return $this->getCacheStorage()->removeItem($id);
}

/**
* Garbage Collection
*
* @param int $maxlifetime
* @return boolean
* @return bool
*/
public function gc($maxlifetime)
{
$cache = $this->getCacheStorge();
$cache = $this->getCacheStorage();
if ($cache instanceof ClearExpiredCacheStorage) {
return $cache->clearExpired();
}
Expand All @@ -140,12 +140,20 @@ public function setCacheStorage(CacheStorage $cacheStorage)
}

/**
* Get Cache Storage Adapter Object
* Get cache storage
*
* @return CacheStorage
*/
public function getCacheStorge()
public function getCacheStorage()
{
return $this->cacheStorage;
}

/**
* @deprecated Misspelled method - use getCacheStorage() instead
*/
public function getCacheStorge()
{
return $this->getCacheStorage();
}
}
10 changes: 5 additions & 5 deletions src/SaveHandler/DbTableGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down Expand Up @@ -70,7 +70,7 @@ public function __construct(TableGateway $tableGateway, DbTableGatewayOptions $o
*
* @param string $savePath
* @param string $name
* @return boolean
* @return bool
*/
public function open($savePath, $name)
{
Expand All @@ -84,7 +84,7 @@ public function open($savePath, $name)
/**
* Close session
*
* @return boolean
* @return bool
*/
public function close()
{
Expand Down Expand Up @@ -119,7 +119,7 @@ public function read($id)
*
* @param string $id
* @param string $data
* @return boolean
* @return bool
*/
public function write($id, $data)
{
Expand Down Expand Up @@ -150,7 +150,7 @@ public function write($id, $data)
* Destroy session
*
* @param string $id
* @return boolean
* @return bool
*/
public function destroy($id)
{
Expand Down
2 changes: 1 addition & 1 deletion src/SaveHandler/DbTableGatewayOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
2 changes: 1 addition & 1 deletion src/SaveHandler/SaveHandlerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
9 changes: 5 additions & 4 deletions src/SessionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down Expand Up @@ -84,9 +84,7 @@ public function start($preserveStorage = false)
}

session_start();
if (!$this->isValid()) {
throw new Exception\RuntimeException('Session validation failed');
}

$storage = $this->getStorage();

// Since session is starting, we need to potentially repopulate our
Expand All @@ -97,6 +95,9 @@ public function start($preserveStorage = false)
}
$_SESSION = $storage;
}
if (!$this->isValid()) {
throw new Exception\RuntimeException('Session validation failed');
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/ArrayStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/SessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/StorageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/HttpUserAgent.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/RemoteAddr.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Validator/ValidatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Session
*/
Expand All @@ -23,7 +23,7 @@ interface ValidatorInterface
* every session to determine if the current environment matches
* that which was store in the setup() procedure.
*
* @return boolean
* @return bool
*/
public function isValid();

Expand Down
Loading

0 comments on commit 9e9a6cb

Please sign in to comment.