Merge branch '2.3'
* 2.3: fixed CS {HttpFoundation] [Session] fixed session compatibility with memcached/redis session storage fixed CS Fixes for hasParameterOption and getParameterOption methods of ArgvInput
This commit is contained in:
commit
3a978503e9
@ -284,9 +284,11 @@ class ArgvInput extends Input
|
|||||||
{
|
{
|
||||||
$values = (array) $values;
|
$values = (array) $values;
|
||||||
|
|
||||||
foreach ($this->tokens as $v) {
|
foreach ($this->tokens as $token) {
|
||||||
if (in_array($v, $values)) {
|
foreach ($values as $value) {
|
||||||
return true;
|
if ($token === $value || 0 === strpos($token, $value.'=')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +313,7 @@ class ArgvInput extends Input
|
|||||||
$tokens = $this->tokens;
|
$tokens = $this->tokens;
|
||||||
while ($token = array_shift($tokens)) {
|
while ($token = array_shift($tokens)) {
|
||||||
foreach ($values as $value) {
|
foreach ($values as $value) {
|
||||||
if (0 === strpos($token, $value)) {
|
if ($token === $value || 0 === strpos($token, $value.'=')) {
|
||||||
if (false !== $pos = strpos($token, '=')) {
|
if (false !== $pos = strpos($token, '=')) {
|
||||||
return substr($token, $pos + 1);
|
return substr($token, $pos + 1);
|
||||||
}
|
}
|
||||||
|
@ -273,6 +273,9 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$input = new ArgvInput(array('cli.php', 'foo'));
|
$input = new ArgvInput(array('cli.php', 'foo'));
|
||||||
$this->assertFalse($input->hasParameterOption('--foo'), '->hasParameterOption() returns false if the given short option is not in the raw input');
|
$this->assertFalse($input->hasParameterOption('--foo'), '->hasParameterOption() returns false if the given short option is not in the raw input');
|
||||||
|
|
||||||
|
$input = new ArgvInput(array('cli.php', '--foo=bar'));
|
||||||
|
$this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given option with provided value is in the raw input');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testToString()
|
public function testToString()
|
||||||
@ -300,6 +303,7 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
|
|||||||
array(array('app/console', 'foo:bar', '--env=dev'), '--env', 'dev'),
|
array(array('app/console', 'foo:bar', '--env=dev'), '--env', 'dev'),
|
||||||
array(array('app/console', 'foo:bar', '-e', 'dev'), array('-e', '--env'), 'dev'),
|
array(array('app/console', 'foo:bar', '-e', 'dev'), array('-e', '--env'), 'dev'),
|
||||||
array(array('app/console', 'foo:bar', '--env=dev'), array('-e', '--env'), 'dev'),
|
array(array('app/console', 'foo:bar', '--env=dev'), array('-e', '--env'), 'dev'),
|
||||||
|
array(array('app/console', 'foo:bar', '--env=dev', '--en=1'), array('--en'), '1'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,13 +210,15 @@ class NativeSessionStorage implements SessionStorageInterface
|
|||||||
$ret = session_regenerate_id($destroy);
|
$ret = session_regenerate_id($destroy);
|
||||||
|
|
||||||
// workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl
|
// workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl
|
||||||
session_write_close();
|
if ('files' === $this->getSaveHandler()->getSaveHandlerName()) {
|
||||||
if (isset($_SESSION)) {
|
session_write_close();
|
||||||
$backup = $_SESSION;
|
if (isset($_SESSION)) {
|
||||||
session_start();
|
$backup = $_SESSION;
|
||||||
$_SESSION = $backup;
|
session_start();
|
||||||
} else {
|
$_SESSION = $backup;
|
||||||
session_start();
|
} else {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
Reference in New Issue
Block a user