Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'hotfix/3201' into develop

Forward port #3201
  • Loading branch information...
commit d0b9231accccbb78ba558ac2354862ad8b02b1f5 2 parents a347c47 + f5c1f4d
@weierophinney weierophinney authored
View
10 library/Zend/Session/Config/SessionConfig.php
@@ -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)
{
@@ -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;
}
View
36 tests/ZendTest/Session/Config/SessionConfigTest.php
@@ -729,6 +729,42 @@ public function testRememberMeSecondsIsMutable()
$this->assertEquals(604800, $this->config->getRememberMeSeconds());
}
+ // setOption
+
+ /**
+ * @dataProvider optionsProvider
+ */
+ public function testSetOptionSetsIniSetting($option, $getter, $value)
+ {
+ // Leaving out special cases.
+ if ($option != 'remember_me_seconds' && $option != 'url_rewriter_tags') {
+ $this->config->setStorageOption($option, $value);
+ $this->assertEquals(ini_get('session.' . $option), $value);
+ }
+ }
+
+ public function testSetOptionUrlRewriterTagsGetsMunged()
+ {
+ $value = 'a=href';
+ $this->config->setStorageOption('url_rewriter_tags', $value);
+ $this->assertEquals(ini_get('url_rewriter.tags'), $value);
+ }
+
+ public function testSetOptionRememberMeSecondsDoesNothing()
+ {
+ // I have no idea how to test this.
+ }
+
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testSetOptionsThrowsExceptionOnInvalidKey()
+ {
+ $badKey = 'snarfblat';
+ $value = 'foobar';
+ $this->config->setStorageOption($badKey, $value);
+ }
+
// setOptions
/**
Please sign in to comment.
Something went wrong with that request. Please try again.