Merge branch '2.3'
* 2.3: [FrameworkBundle][Security] Replaced void return type with null for consistency fixed CS NativeSessionStorage regenerate removed unneeded comment Use setTimeZone if this method exists. Fix FileResource test fixed wrong usage of unset() [HttpFoundation] Fixed the way path to directory is trimmed. [Console] Fixed argument parsing when a single dash is passed.
This commit is contained in:
commit
fc437cf6fb
@ -26,6 +26,9 @@ class GlobalVariables
|
|||||||
{
|
{
|
||||||
protected $container;
|
protected $container;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ContainerInterface $container The DI container
|
||||||
|
*/
|
||||||
public function __construct(ContainerInterface $container)
|
public function __construct(ContainerInterface $container)
|
||||||
{
|
{
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
@ -46,7 +49,7 @@ class GlobalVariables
|
|||||||
/**
|
/**
|
||||||
* Returns the current user.
|
* Returns the current user.
|
||||||
*
|
*
|
||||||
* @return mixed|void
|
* @return mixed
|
||||||
*
|
*
|
||||||
* @see TokenInterface::getUser()
|
* @see TokenInterface::getUser()
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +20,7 @@ class FileResourceTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->file = sys_get_temp_dir().'/tmp.xml';
|
$this->file = realpath(sys_get_temp_dir()).'/tmp.xml';
|
||||||
touch($this->file);
|
touch($this->file);
|
||||||
$this->resource = new FileResource($this->file);
|
$this->resource = new FileResource($this->file);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ class ArgvInput extends Input
|
|||||||
$parseOptions = false;
|
$parseOptions = false;
|
||||||
} elseif ($parseOptions && 0 === strpos($token, '--')) {
|
} elseif ($parseOptions && 0 === strpos($token, '--')) {
|
||||||
$this->parseLongOption($token);
|
$this->parseLongOption($token);
|
||||||
} elseif ($parseOptions && '-' === $token[0]) {
|
} elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
|
||||||
$this->parseShortOption($token);
|
$this->parseShortOption($token);
|
||||||
} else {
|
} else {
|
||||||
$this->parseArgument($token);
|
$this->parseArgument($token);
|
||||||
|
@ -306,4 +306,11 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
|
|||||||
array(array('app/console', 'foo:bar', '--env=dev', '--en=1'), array('--en'), '1'),
|
array(array('app/console', 'foo:bar', '--env=dev', '--en=1'), array('--en'), '1'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testParseSingleDashAsArgument()
|
||||||
|
{
|
||||||
|
$input = new ArgvInput(array('cli.php', '-'));
|
||||||
|
$input->bind(new InputDefinition(array(new InputArgument('file'))));
|
||||||
|
$this->assertEquals(array('file' => '-'), $input->getArguments(), '->parse() parses single dash as an argument');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ class ErrorHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->reservedMemory);
|
$this->reservedMemory = '';
|
||||||
$type = $error['type'];
|
$type = $error['type'];
|
||||||
if (0 === $this->level || !in_array($type, array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE))) {
|
if (0 === $this->level || !in_array($type, array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE))) {
|
||||||
return;
|
return;
|
||||||
|
@ -247,7 +247,7 @@ class DateType extends AbstractType
|
|||||||
$pattern = $formatter->getPattern();
|
$pattern = $formatter->getPattern();
|
||||||
$timezone = $formatter->getTimezoneId();
|
$timezone = $formatter->getTimezoneId();
|
||||||
|
|
||||||
if (version_compare(\PHP_VERSION, '5.5.0-dev', '>=')) {
|
if ($setTimeZone = method_exists($formatter, 'setTimeZone')) {
|
||||||
$formatter->setTimeZone('UTC');
|
$formatter->setTimeZone('UTC');
|
||||||
} else {
|
} else {
|
||||||
$formatter->setTimeZoneId('UTC');
|
$formatter->setTimeZoneId('UTC');
|
||||||
@ -265,7 +265,7 @@ class DateType extends AbstractType
|
|||||||
$formatter->setPattern($pattern);
|
$formatter->setPattern($pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version_compare(\PHP_VERSION, '5.5.0-dev', '>=')) {
|
if ($setTimeZone) {
|
||||||
$formatter->setTimeZone($timezone);
|
$formatter->setTimeZone($timezone);
|
||||||
} else {
|
} else {
|
||||||
$formatter->setTimeZoneId($timezone);
|
$formatter->setTimeZoneId($timezone);
|
||||||
|
@ -137,7 +137,7 @@ class File extends \SplFileInfo
|
|||||||
throw new FileException(sprintf('Unable to write in the "%s" directory', $directory));
|
throw new FileException(sprintf('Unable to write in the "%s" directory', $directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
$target = trim($directory, '/\\').DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name));
|
$target = rtrim($directory, '/\\').DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name));
|
||||||
|
|
||||||
return new File($target, false);
|
return new File($target, false);
|
||||||
}
|
}
|
||||||
|
@ -219,6 +219,8 @@ class NativeSessionStorage implements SessionStorageInterface
|
|||||||
} else {
|
} else {
|
||||||
session_start();
|
session_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->loadSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
@ -135,7 +135,7 @@ class ProfilerListener implements EventSubscriberInterface
|
|||||||
if ($master) {
|
if ($master) {
|
||||||
$this->saveProfiles($profile);
|
$this->saveProfiles($profile);
|
||||||
|
|
||||||
unset($this->children);
|
$this->children = new \SplObjectStorage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,8 +80,6 @@ interface UserInterface
|
|||||||
*
|
*
|
||||||
* This is important if, at any given point, sensitive information like
|
* This is important if, at any given point, sensitive information like
|
||||||
* the plain-text password is stored on this object.
|
* the plain-text password is stored on this object.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function eraseCredentials();
|
public function eraseCredentials();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user