diff --git a/.travis.yml b/.travis.yml index 425aeb9eaf..5e3646df3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,6 @@ matrix: - php: 5.3 - php: 5.4 - php: 5.5 - - php: 5.6 - php: 5.6 env: deps=low - php: 5.6 diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 10f76a6f79..de9a230a55 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -299,6 +299,17 @@ UPGRADE FROM 2.x to 3.0 ```php echo $form->getErrors(true, false); ``` + * The `Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList` class has been removed in + favor of `Symfony\Component\Form\ChoiceList\ArrayChoiceList`. + + * The `Symfony\Component\Form\Extension\Core\ChoiceList\LazyChoiceList` class has been removed in + favor of `Symfony\Component\Form\ChoiceList\LazyChoiceList`. + + * The `Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList` class has been removed in + favor of `Symfony\Component\Form\ChoiceList\ArrayChoiceList`. + + * The `Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList` class has been removed in + favor of `Symfony\Component\Form\ChoiceList\ArrayChoiceList`. ### FrameworkBundle diff --git a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php index 94ac80d884..610d5a6068 100644 --- a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php @@ -73,15 +73,28 @@ class TwigExtractorTest extends \PHPUnit_Framework_TestCase /** * @expectedException \Twig_Error - * @expectedExceptionMessageRegExp /Unclosed "block" in "extractor(\/|\\)syntax_error\.twig" at line 1/ + * @expectedExceptionMessageRegExp /Unclosed "block" in ".*extractor(\/|\\)syntax_error\.twig" at line 1/ + * @dataProvider resourcesWithSyntaxErrorsProvider */ - public function testExtractSyntaxError() + public function testExtractSyntaxError($resources) { $twig = new \Twig_Environment(new \Twig_Loader_Array(array())); $twig->addExtension(new TranslationExtension($this->getMock('Symfony\Component\Translation\TranslatorInterface'))); $extractor = new TwigExtractor($twig); - $extractor->extract(__DIR__.'/../Fixtures', new MessageCatalogue('en')); + $extractor->extract($resources, new MessageCatalogue('en')); + } + + /** + * @return array + */ + public function resourcesWithSyntaxErrorsProvider() + { + return array( + array(__DIR__.'/../Fixtures'), + array(__DIR__.'/../Fixtures/extractor/syntax_error.twig'), + array(new \SplFileInfo(__DIR__.'/../Fixtures/extractor/syntax_error.twig')), + ); } /** diff --git a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php index ad3fd9fe33..d892fe7303 100644 --- a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php +++ b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php @@ -12,6 +12,7 @@ namespace Symfony\Bridge\Twig\Translation; use Symfony\Component\Finder\Finder; +use Symfony\Component\Finder\SplFileInfo; use Symfony\Component\Translation\Extractor\AbstractFileExtractor; use Symfony\Component\Translation\Extractor\ExtractorInterface; use Symfony\Component\Translation\MessageCatalogue; @@ -60,7 +61,11 @@ class TwigExtractor extends AbstractFileExtractor implements ExtractorInterface try { $this->extractTemplate(file_get_contents($file->getPathname()), $catalogue); } catch (\Twig_Error $e) { - $e->setTemplateFile($file->getRelativePathname()); + if ($file instanceof SplFileInfo) { + $e->setTemplateFile($file->getRelativePathname()); + } elseif ($file instanceof \SplFileInfo) { + $e->setTemplateFile($file->getRealPath()); + } throw $e; } diff --git a/src/Symfony/Component/Asset/UrlPackage.php b/src/Symfony/Component/Asset/UrlPackage.php index 0e9f82d0fa..6381a9c1cd 100644 --- a/src/Symfony/Component/Asset/UrlPackage.php +++ b/src/Symfony/Component/Asset/UrlPackage.php @@ -36,7 +36,6 @@ use Symfony\Component\Asset\Exception\LogicException; class UrlPackage extends Package { private $baseUrls = array(); - private $sslUrls; private $sslPackage; /** @@ -62,7 +61,7 @@ class UrlPackage extends Package $sslUrls = $this->getSslUrls($baseUrls); if ($sslUrls && $baseUrls !== $sslUrls) { - $this->sslPackage = new UrlPackage($sslUrls, $versionStrategy); + $this->sslPackage = new self($sslUrls, $versionStrategy); } } diff --git a/src/Symfony/Component/Console/Output/ConsoleOutput.php b/src/Symfony/Component/Console/Output/ConsoleOutput.php index 708d171445..50ef4df900 100644 --- a/src/Symfony/Component/Console/Output/ConsoleOutput.php +++ b/src/Symfony/Component/Console/Output/ConsoleOutput.php @@ -46,12 +46,9 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface */ public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null) { - $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output'; - $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output'; + parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter); - parent::__construct(fopen($outputStream, 'w'), $verbosity, $decorated, $formatter); - - $this->stderr = new StreamOutput(fopen($errorStream, 'w'), $verbosity, $decorated, $this->getFormatter()); + $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter()); } /** @@ -129,4 +126,24 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface { return 'OS400' === php_uname('s'); } + + /** + * @return resource + */ + private function openOutputStream() + { + $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output'; + + return @fopen($outputStream, 'w') ?: fopen('php://output', 'w'); + } + + /** + * @return resource + */ + private function openErrorStream() + { + $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output'; + + return fopen($errorStream, 'w'); + } } diff --git a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php index 8746d2bea8..7c068fe49b 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php @@ -115,9 +115,9 @@ class SwitchUserListener implements ListenerInterface if (false !== $originalToken) { if ($token->getUsername() === $request->get($this->usernameParameter)) { return $token; - } else { - throw new \LogicException(sprintf('You are already switched to "%s" user.', $token->getUsername())); } + + throw new \LogicException(sprintf('You are already switched to "%s" user.', $token->getUsername())); } if (false === $this->accessDecisionManager->decide($token, array($this->role))) { diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index cd5e1dc571..311ef18a37 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -234,7 +234,7 @@ class Parser } // 1-liner optionally followed by newline(s) - if ($this->lines[0] === trim($value)) { + if (is_string($value) && $this->lines[0] === trim($value)) { try { $value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs); } catch (ParseException $e) { diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index 6e39e7dc66..f434d5585d 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -551,6 +551,21 @@ EOF ); } + /** + * @expectedException \Symfony\Component\Yaml\Exception\ParseException + * @expectedExceptionMessage missing colon + */ + public function testScalarInSequence() + { + Yaml::parse(<< It is an error for two equal keys to appear in the same mapping node. * > In such a case the YAML processor may continue, ignoring the second