diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php b/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php index af3b34ac9b..c223ab9022 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php @@ -26,6 +26,9 @@ class GlobalVariables { protected $container; + /** + * @param ContainerInterface $container The DI container + */ public function __construct(ContainerInterface $container) { $this->container = $container; @@ -46,7 +49,7 @@ class GlobalVariables /** * Returns the current user. * - * @return mixed|void + * @return mixed * * @see TokenInterface::getUser() */ diff --git a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php index 5eb3d57290..637f95132c 100644 --- a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php @@ -20,7 +20,7 @@ class FileResourceTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->file = sys_get_temp_dir().'/tmp.xml'; + $this->file = realpath(sys_get_temp_dir()).'/tmp.xml'; touch($this->file); $this->resource = new FileResource($this->file); } diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index ce2850495c..0d6b327629 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -84,7 +84,7 @@ class ArgvInput extends Input $parseOptions = false; } elseif ($parseOptions && 0 === strpos($token, '--')) { $this->parseLongOption($token); - } elseif ($parseOptions && '-' === $token[0]) { + } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) { $this->parseShortOption($token); } else { $this->parseArgument($token); diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php index 26029c7f7c..507990d2cf 100644 --- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php +++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php @@ -306,4 +306,11 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase 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'); + } } diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 52fd7a50f7..87e0c037e2 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -137,7 +137,7 @@ class ErrorHandler return; } - unset($this->reservedMemory); + $this->reservedMemory = ''; $type = $error['type']; if (0 === $this->level || !in_array($type, array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE))) { return; diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index 8fdbf86612..5f1586ea81 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -247,7 +247,7 @@ class DateType extends AbstractType $pattern = $formatter->getPattern(); $timezone = $formatter->getTimezoneId(); - if (version_compare(\PHP_VERSION, '5.5.0-dev', '>=')) { + if ($setTimeZone = method_exists($formatter, 'setTimeZone')) { $formatter->setTimeZone('UTC'); } else { $formatter->setTimeZoneId('UTC'); @@ -265,7 +265,7 @@ class DateType extends AbstractType $formatter->setPattern($pattern); } - if (version_compare(\PHP_VERSION, '5.5.0-dev', '>=')) { + if ($setTimeZone) { $formatter->setTimeZone($timezone); } else { $formatter->setTimeZoneId($timezone); diff --git a/src/Symfony/Component/HttpFoundation/File/File.php b/src/Symfony/Component/HttpFoundation/File/File.php index 0646b61aa3..4fabfb9106 100644 --- a/src/Symfony/Component/HttpFoundation/File/File.php +++ b/src/Symfony/Component/HttpFoundation/File/File.php @@ -137,7 +137,7 @@ class File extends \SplFileInfo 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); } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index d86ff33d1d..2850bb28ba 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -219,6 +219,8 @@ class NativeSessionStorage implements SessionStorageInterface } else { session_start(); } + + $this->loadSession(); } return $ret; diff --git a/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php b/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php index 43dfaff5c5..30d4011ffe 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php @@ -136,7 +136,7 @@ class ProfilerListener implements EventSubscriberInterface if ($master) { $this->saveProfiles($profile); - unset($this->children); + $this->children = new \SplObjectStorage(); } } diff --git a/src/Symfony/Component/Security/Core/User/UserInterface.php b/src/Symfony/Component/Security/Core/User/UserInterface.php index f5bbde2fc6..6e9b0f1899 100644 --- a/src/Symfony/Component/Security/Core/User/UserInterface.php +++ b/src/Symfony/Component/Security/Core/User/UserInterface.php @@ -80,8 +80,6 @@ interface UserInterface * * This is important if, at any given point, sensitive information like * the plain-text password is stored on this object. - * - * @return void */ public function eraseCredentials(); }