Merge branch '2.7' into 2.8
* 2.7: [Yaml] throw a ParseException on invalid data type [TwigBridge] type-dependent path discovery Resources as string have the same problem Introduce failing test case when a SplFileInfo object is passed to the extract() method in the TwigExtractor. #15331 add infos about deprecated classes to UPGRADE-3.0 [Asset] removed unused private property. [Security] removed useless else condition in SwitchUserListener class. [travis] Tests deps=low with PHP 5.6 [Console] Fix console output with closed stdout
This commit is contained in:
commit
96e211d2da
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -551,6 +551,21 @@ EOF
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage missing colon
|
||||
*/
|
||||
public function testScalarInSequence()
|
||||
{
|
||||
Yaml::parse(<<<EOF
|
||||
foo:
|
||||
- bar
|
||||
"missing colon"
|
||||
foo: bar
|
||||
EOF
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* > 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
|
||||
|
|
Reference in New Issue