Skip to content

Commit

Permalink
Merge branch 'hotfix/3713' into develop
Browse files Browse the repository at this point in the history
Forward port zendframework#3713
  • Loading branch information
weierophinney committed Feb 7, 2013
2 parents 9b92d74 + b05bc6e commit c5cc2d2
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 18 deletions.
2 changes: 1 addition & 1 deletion library/Zend/Session/AbstractContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ protected function verifyNamespace($createContainer = true)
}
$storage[$name] = $this->createContainer();
}
if (!is_array($storage[$name]) && !$storage[$name] instanceof ArrayObject) {
if (!is_array($storage[$name]) && !$storage[$name] instanceof Traversable) {
throw new Exception\RuntimeException('Container cannot write to storage due to type mismatch');
}

Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Session/compatibility/autoload.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
if (version_compare(PHP_VERSION, '5.3.3', 'le')) {
if (version_compare(PHP_VERSION, '5.3.4', 'lt')) {
require_once __DIR__ . '/Container.php';
require_once __DIR__ . '/Storage/SessionArrayStorage.php';
}
2 changes: 1 addition & 1 deletion library/Zend/Stdlib/compatibility/autoload.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
if (version_compare(PHP_VERSION, '5.3.3', 'le')) {
if (version_compare(PHP_VERSION, '5.3.4', 'lt')) {
require_once __DIR__ . '/ArrayObject.php';
}
16 changes: 14 additions & 2 deletions tests/ZendTest/Session/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ protected function forceAutoloader()
public function run(\PHPUnit_Framework_TestResult $result = NULL)
{
$this->setPreserveGlobalState(false);

return parent::run($result);
}

Expand Down Expand Up @@ -529,11 +530,22 @@ public function testExchangeArray()

public function testMultiDimensionalUnset()
{
if (version_compare(PHP_VERSION, '5.3.3') <= 0) {
$this->markTestSkipped('Known issue on versions of PHP 5.3.3 or less');
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);
}

public function testUpgradeBehaviors()
{
$storage = $this->manager->getStorage();
$storage['foo'] = new \ArrayObject(array('bar' => 'baz'));

$container = new Container('foo', $this->manager);
$this->assertEquals('baz', $container->bar);
$container->baz = 'boo';
$this->assertEquals('boo', $storage['foo']['baz']);
}
}
4 changes: 2 additions & 2 deletions tests/ZendTest/Session/SessionArrayStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public function testUnset()

public function testMultiDimensionalUnset()
{
if (version_compare(PHP_VERSION, '5.3.3') <= 0) {
$this->markTestSkipped('Known issue on versions of PHP 5.3.3 or less');
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']);
Expand Down
4 changes: 2 additions & 2 deletions tests/ZendTest/Session/SessionStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public function testMarkingOneSessionObjectImmutableShouldMarkOtherInstancesImmu

public function testMultiDimensionalUnset()
{
if (version_compare(PHP_VERSION, '5.3.3') <= 0) {
$this->markTestSkipped('Known issue on versions of PHP 5.3.3 or less');
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']);
Expand Down
4 changes: 2 additions & 2 deletions tests/ZendTest/Session/StorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ public function testToArrayWithMetaData()

public function testUnsetMultidimensional()
{
if (version_compare(PHP_VERSION, '5.3.3') <= 0) {
$this->markTestSkipped('Known issue on versions of PHP 5.3.3 or less');
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']);
Expand Down
14 changes: 7 additions & 7 deletions tests/ZendTest/Stdlib/ArrayObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testStdPropList()

public function testStdPropListCannotAccessObjectVars()
{
if (version_compare(PHP_VERSION, '5.3.3') <= 0) {
if (version_compare(PHP_VERSION, '5.3.4') < 0) {
$this->markTestSkipped('Behavior is for overwritten ArrayObject in greater than 5.3.3');
}
$this->setExpectedException('InvalidArgumentException');
Expand Down Expand Up @@ -162,7 +162,7 @@ public function testIteratorClass()

public function testInvalidIteratorClassThrowsInvalidArgumentException()
{
if (version_compare(PHP_VERSION, '5.3.3') <= 0) {
if (version_compare(PHP_VERSION, '5.3.4') < 0) {
$this->markTestSkipped('Behavior is for overwritten ArrayObject in greater than 5.3.3');
}
$this->setExpectedException('InvalidArgumentException');
Expand Down Expand Up @@ -210,7 +210,7 @@ public function testOffsetExists()

public function testOffsetExistsThrowsExceptionOnProtectedProperty()
{
if (version_compare(PHP_VERSION, '5.3.3') <= 0) {
if (version_compare(PHP_VERSION, '5.3.4') < 0) {
$this->markTestSkipped('Behavior is for overwritten ArrayObject in greater than 5.3.3');
}
$this->setExpectedException('InvalidArgumentException');
Expand All @@ -232,7 +232,7 @@ public function testOffsetGetOffsetSet()

public function testOffsetGetThrowsExceptionOnProtectedProperty()
{
if (version_compare(PHP_VERSION, '5.3.3') <= 0) {
if (version_compare(PHP_VERSION, '5.3.4') < 0) {
$this->markTestSkipped('Behavior is for overwritten ArrayObject in greater than 5.3.3');
}
$this->setExpectedException('InvalidArgumentException');
Expand All @@ -242,7 +242,7 @@ public function testOffsetGetThrowsExceptionOnProtectedProperty()

public function testOffsetSetThrowsExceptionOnProtectedProperty()
{
if (version_compare(PHP_VERSION, '5.3.3') <= 0) {
if (version_compare(PHP_VERSION, '5.3.4') < 0) {
$this->markTestSkipped('Behavior is for overwritten ArrayObject in greater than 5.3.3');
}
$this->setExpectedException('InvalidArgumentException');
Expand All @@ -264,7 +264,7 @@ public function testOffsetUnset()

public function testOffsetUnsetMultidimensional()
{
if (version_compare(PHP_VERSION, '5.3.3') <= 0) {
if (version_compare(PHP_VERSION, '5.3.4') < 0) {
$this->markTestSkipped('Behavior is for overwritten ArrayObject in greater than 5.3.3');
}
$ar = new ArrayObject();
Expand All @@ -274,7 +274,7 @@ public function testOffsetUnsetMultidimensional()

public function testOffsetUnsetThrowsExceptionOnProtectedProperty()
{
if (version_compare(PHP_VERSION, '5.3.3') <= 0) {
if (version_compare(PHP_VERSION, '5.3.4') < 0) {
$this->markTestSkipped('Behavior is for overwritten ArrayObject in greater than 5.3.3');
}
$this->setExpectedException('InvalidArgumentException');
Expand Down

0 comments on commit c5cc2d2

Please sign in to comment.