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

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
Promote develop to master, becoming the next stable release.
  • Loading branch information
weierophinney committed Mar 12, 2014
193 parents 5a32e1b + 4d8e4f7 + 46af048 + f8de14f + 5bd58ff + 3efc3e6 + fbe1bf7 + 599bb28 + a1894dc + 5d1b205 + 09ba436 + f8fc5b0 + 17494e9 + 91105ad + e3a1818 + a31ffcc + 370a890 + 79102c3 + 0d79e94 + c3f023e + 7ee4fbe + 7c5f46f + 93e1c5e + 300993b + 3fa60b1 + 56e7a3b + f66fb69 + 65e3dc5 + 893db4e + 1f95227 + 37eba61 + a8a134d + 2a58e81 + c687156 + ff43991 + bad6a8b + aba47b0 + 955d97a + 2b78fdc + 0094c19 + 4985e6d + d904244 + 52367d8 + dce778a + 2305c94 + 052b9a4 + ef11064 + 4efb47c + b3dcf28 + 778fbea + cdde9b4 + 6ade9b9 + 435888b + 2ad89a8 + e232251 + 5932189 + d0360d2 + 52242e5 + 3804b57 + 1cecc58 + 4a4065c + f9b61b5 + 0a07b63 + 0e321e0 + 95ceb90 + 4380d08 + ec9c36c + 4de92b2 + b6eb950 + fca746d + ff69119 + 5351804 + 3617ea6 + 24c8a1f + 0aa6c03 + b24267c + beadb3c + 51c4ced + d92ccc9 + eb1f131 + f383de1 + abc631a + 666ec86 + e22a167 + bb8b8f6 + b55f760 + f23a913 + 9ba9f17 + d01f94f + 9c4e0cc + 63c4a7e + 9eedf95 + 980bffb + 03cf7b3 + 8bbf35d + aff3454 + 1c6567c + a102513 + 90b7795 + 286539e + 7f08291 + 417d368 + ae0f13d + 7894420 + 8ff1b30 + 55ca16f + 0c6cb6c + 7010e32 + 745a36a + f021693 + cd91ba2 + 5586879 + 1cd9259 + b611b41 + e07e054 + 7657d67 + 52b6014 + 00211c2 + 0d594de + f919c63 + 7e217f4 + 3e0da00 + 3723e41 + facd3ee + 4d8294f + 3cdb12a + f09df31 + 34e6a86 + 4e1b451 + 2d3566a + ef9466a + 3c172af + 2260c5e + dd964bc + f325c01 + 3cd4478 + dc3a58e + cf0af6f + 6e93d7b + 6b3eedb + ce63e39 + 1bd656e + cc16778 + 720b563 + 039e86a + b27a1fe + 88022d1 + b4847de + 1b48124 + 6a22f1e + b63de1e + 770056f + 9e9a6cb + f6a6b75 + 9533639 + 82f2194 + 1c82c93 + b2d0ea0 + 65cd119 + b2e527d + 513214f + 3a8340e + 251bd01 + 6cd974a + 8a9cfe7 + c0ef35c + a4120f3 + 83998db + ce6e83d + 79d9ad3 + 06667fc + e9a0a25 + 8a45042 + 476e819 + ec53915 + dabe526 + 1fb31ae + 024bfa8 + ef75c1e + 3cbded1 + 9dee916 + 0c6dac5 + 5ed4ac8 + 02638f8 + 4048ff7 + 473d00f + 2c93b15 + 1434be5 + 4434ad7 + 5b730f6 + b096cd2 + 05aa430 + d9cc6c3 commit cc8b469
Show file tree
Hide file tree
Showing 28 changed files with 89 additions and 129 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
"require": {
"php": ">=5.3.3",
"php": ">=5.3.23",
"zendframework/zend-eventmanager": "self.version",
"zendframework/zend-stdlib": "self.version"
},
Expand All @@ -23,6 +23,7 @@
"zendframework/zend-http": "self.version",
"zendframework/zend-servicemanager": "self.version",
"zendframework/zend-validator": "self.version",
"zendframework/zend-eventmanager": "self.version",
"fabpot/php-cs-fixer": "1.7.*",
"satooshi/php-coveralls": "dev-master",
"phpunit/PHPUnit": "~4.0"
Expand Down
1 change: 1 addition & 0 deletions src/Config/SessionConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class SessionConfig extends StandardConfig
* @var array Valid cache limiters (per session.cache_limiter)
*/
protected $validCacheLimiters = array(
'',
'nocache',
'public',
'private',
Expand Down
26 changes: 19 additions & 7 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@

namespace Zend\Session;

if (version_compare(PHP_VERSION, '5.3.4', 'lt')) {
class_alias('Zend\Session\AbstractContainer', 'Zend\Session\AbstractBaseContainer');
} else {
class_alias('Zend\Session\Container\PhpReferenceCompatibility', 'Zend\Session\AbstractBaseContainer');
}

/**
* Session storage container
*
Expand All @@ -23,6 +17,24 @@ class_alias('Zend\Session\Container\PhpReferenceCompatibility', 'Zend\Session\Ab
* Additionally, expiries may be absolute TTLs or measured in "hops", which
* are based on how many times the key or container were accessed.
*/
class Container extends AbstractBaseContainer
class Container extends AbstractContainer
{
/**
* Retrieve a specific key in the container
*
* @param string $key
* @return mixed
*/
public function &offsetGet($key)
{
$ret = null;
if (!$this->offsetExists($key)) {
return $ret;
}
$storage = $this->getStorage();
$name = $this->getName();
$ret =& $storage[$name][$key];

return $ret;
}
}
37 changes: 0 additions & 37 deletions src/Container/PhpReferenceCompatibility.php

This file was deleted.

10 changes: 10 additions & 0 deletions src/Service/SessionManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class SessionManagerFactory implements FactoryInterface
* - enable_default_container_manager: whether to inject the created instance
* as the default manager for Container instances. The default value for
* this is true; set it to false to disable.
* - validators: ...
*
* @param ServiceLocatorInterface $services
* @return SessionManager
Expand Down Expand Up @@ -112,6 +113,15 @@ public function createService(ServiceLocatorInterface $services)
) {
$managerConfig = array_merge($managerConfig, $configService['session_manager']);
}
// Attach validators to session manager, if any
if (isset($managerConfig['validators'])) {
$chain = $manager->getValidatorChain();
foreach ($managerConfig['validators'] as $validator) {
$validator = new $validator();
$chain->attach('session.validate', array($validator, 'isValid'));

}
}
}

// If configuration enables the session manager as the default manager for container
Expand Down
29 changes: 22 additions & 7 deletions src/Storage/SessionArrayStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,30 @@

namespace Zend\Session\Storage;

if (version_compare(PHP_VERSION, '5.3.4', 'lt')) {
class_alias('Zend\Session\Storage\AbstractSessionArrayStorage', 'Zend\Session\Storage\AbstractBaseSessionArrayStorage');
} else {
class_alias('Zend\Session\Storage\SessionArrayStorage\PhpReferenceCompatibility', 'Zend\Session\Storage\AbstractBaseSessionArrayStorage');
}

/**
* Session storage in $_SESSION
*/
class SessionArrayStorage extends AbstractBaseSessionArrayStorage
class SessionArrayStorage extends AbstractSessionArrayStorage
{
/**
* Get Offset
*
* @param mixed $key
* @return mixed
*/
public function &__get($key)
{
return $_SESSION[$key];
}

/**
* Offset Get
*
* @param mixed $key
* @return mixed
*/
public function &offsetGet($key)
{
return $_SESSION[$key];
}
}
40 changes: 0 additions & 40 deletions src/Storage/SessionArrayStorage/PhpReferenceCompatibility.php

This file was deleted.

3 changes: 2 additions & 1 deletion test/Config/SessionConfigTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -517,6 +517,7 @@ public function testSettingInvalidEntropyLengthRaisesException2()
public function cacheLimiters()
{
return array(
array(''),
array('nocache'),
array('public'),
array('private'),
Expand Down
2 changes: 1 addition & 1 deletion test/Config/StandardConfigTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
5 changes: 1 addition & 4 deletions test/ContainerTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -537,9 +537,6 @@ public function testExchangeArrayObject()

public function testMultiDimensionalUnset()
{
if (version_compare(PHP_VERSION, '5.3.4') < 0) {
$this->markTestSkipped('Known issue on versions of PHP less than 5.3.4');
}
$this->container->foo = array('bar' => 'baz');
unset($this->container['foo']['bar']);
$this->assertSame(array(), $this->container->foo);
Expand Down
2 changes: 1 addition & 1 deletion test/SaveHandler/CacheTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/SaveHandler/DbTableGatewayOptionsTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/SaveHandler/DbTableGatewayTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/SaveHandler/MongoDBOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/SaveHandler/MongoDBTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Service/ContainerAbstractServiceFactoryTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Service/SessionConfigFactoryTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
15 changes: 14 additions & 1 deletion test/Service/SessionManagerFactoryTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -74,4 +74,17 @@ public function testCanDisableContainerDefaultManagerInjectionViaConfiguration()
$manager = $this->services->get('Zend\Session\ManagerInterface');
$this->assertNotSame($manager, Container::getDefaultManager());
}

public function testFactoryWillAddValidatorViaConfiguration()
{
$config = array('session_manager' => array(
'validators' => array(
'Zend\Session\Validator\RemoteAddr',
),
));
$this->services->setService('Config', $config);
$manager = $this->services->get('Zend\Session\ManagerInterface');

$this->assertEquals(1, $manager->getValidatorChain()->getListeners('session.validate')->count());
}
}
2 changes: 1 addition & 1 deletion test/Service/StorageFactoryTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
9 changes: 1 addition & 8 deletions test/SessionArrayStorageTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -108,9 +108,6 @@ public function testUnset()

public function testMultiDimensionalUnset()
{
if (version_compare(PHP_VERSION, '5.3.4') < 0) {
$this->markTestSkipped('Known issue on versions of PHP less than 5.3.4');
}
$this->storage['foo'] = array('bar' => array('baz' => 'boo'));
unset($this->storage['foo']['bar']['baz']);
$this->assertFalse(isset($this->storage['foo']['bar']['baz']));
Expand Down Expand Up @@ -144,10 +141,6 @@ public function testToArrayWithMetaData()

public function testUndefinedSessionManipulation()
{
if (version_compare(PHP_VERSION, '5.3.4') < 0) {
$this->markTestSkipped('Known issue on versions of PHP less than 5.3.4');
}

$this->storage['foo'] = 'bar';
$this->storage['bar'][] = 'bar';
$this->storage['baz']['foo'] = 'bar';
Expand Down
2 changes: 1 addition & 1 deletion test/SessionManagerTest.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-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
Loading

0 comments on commit cc8b469

Please sign in to comment.