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

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cdekok committed Mar 7, 2013
148 parents 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 + 79102c3 + 0d79e94 + 370a890 commit c0ef35c
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 89 deletions.
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
"autoload": {
"psr-4": {
"Zend\\Session\\": "src/"
},
"files": [
"Zend/Session/compatibility/autoload.php"
]
}
},
"require": {
"php": ">=5.3.3",
Expand Down
26 changes: 7 additions & 19 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

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 @@ -17,24 +23,6 @@
* 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 AbstractContainer
class Container extends AbstractBaseContainer
{
/**
* 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: 37 additions & 0 deletions src/Container/PhpReferenceCompatibility.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* 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)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Session\Container;

use Zend\Session\AbstractContainer;

/**
* Session storage container for PHP 5.3.4 and above.
*/
abstract class PhpReferenceCompatibility 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;
}
}
6 changes: 2 additions & 4 deletions src/Storage/AbstractSessionArrayStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ abstract class AbstractSessionArrayStorage implements IteratorAggregate, Storage
* Constructor
*
* @param array|null $input
* @param int $flags
* @param string $iteratorClass
*/
public function __construct($input = null)
{
Expand Down Expand Up @@ -169,6 +167,7 @@ public function serialize()
/**
* Unserialize
*
* @param string $session
* @return mixed
*/
public function unserialize($session)
Expand Down Expand Up @@ -448,8 +447,7 @@ protected function setRequestAccessTime($time)
/**
* Cast the object to an array
*
* Returns data only, no metadata.
*
* @param bool $metaData Whether to include metadata
* @return array
*/
public function toArray($metaData = false)
Expand Down
3 changes: 1 addition & 2 deletions src/Storage/ArrayStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,7 @@ public function fromArray(array $array)
/**
* Cast the object to an array
*
* Returns data only, no metadata.
*
* @param bool $metaData Whether to include metadata
* @return array
*/
public function toArray($metaData = false)
Expand Down
29 changes: 7 additions & 22 deletions src/Storage/SessionArrayStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,15 @@

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 AbstractSessionArrayStorage
class SessionArrayStorage extends AbstractBaseSessionArrayStorage
{
/**
* 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: 40 additions & 0 deletions src/Storage/SessionArrayStorage/PhpReferenceCompatibility.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* 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)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Session\Storage\SessionArrayStorage;

use Zend\Session\Storage\AbstractSessionArrayStorage;

/**
* PHP 5.3.4 and greater variant of SessionArrayStorage
*/
abstract class PhpReferenceCompatibility 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];
}
}
17 changes: 0 additions & 17 deletions src/compatibility/Container.php

This file was deleted.

17 changes: 0 additions & 17 deletions src/compatibility/Storage/SessionArrayStorage.php

This file was deleted.

17 changes: 13 additions & 4 deletions src/compatibility/autoload.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php
if (version_compare(PHP_VERSION, '5.3.4', 'lt')) {
require_once __DIR__ . '/Container.php';
require_once __DIR__ . '/Storage/SessionArrayStorage.php';
}
/**
* 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)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @deprecated
*/

/**
* Legacy purposes only, to prevent code that references it from breaking.
*/
trigger_error('Polyfill autoload support (file library/Zend/Session/compatibility/autoload.php) is no longer necessary; please remove your require statement referencing this file', E_USER_DEPRECATED);

0 comments on commit c0ef35c

Please sign in to comment.