Skip to content

Commit 96e211d

Browse files
committed
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
2 parents 415e6f6 + cd8ccff commit 96e211d

File tree

9 files changed

+74
-15
lines changed

9 files changed

+74
-15
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ matrix:
1313
- php: 5.3
1414
- php: 5.4
1515
- php: 5.5
16-
- php: 5.6
1716
- php: 5.6
1817
env: deps=low
1918
- php: 5.6

UPGRADE-3.0.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,17 @@ UPGRADE FROM 2.x to 3.0
299299
```php
300300
echo $form->getErrors(true, false);
301301
```
302+
* The `Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList` class has been removed in
303+
favor of `Symfony\Component\Form\ChoiceList\ArrayChoiceList`.
304+
305+
* The `Symfony\Component\Form\Extension\Core\ChoiceList\LazyChoiceList` class has been removed in
306+
favor of `Symfony\Component\Form\ChoiceList\LazyChoiceList`.
307+
308+
* The `Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList` class has been removed in
309+
favor of `Symfony\Component\Form\ChoiceList\ArrayChoiceList`.
310+
311+
* The `Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList` class has been removed in
312+
favor of `Symfony\Component\Form\ChoiceList\ArrayChoiceList`.
302313

303314
### FrameworkBundle
304315

src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,28 @@ public function getExtractData()
7373

7474
/**
7575
* @expectedException \Twig_Error
76-
* @expectedExceptionMessageRegExp /Unclosed "block" in "extractor(\/|\\)syntax_error\.twig" at line 1/
76+
* @expectedExceptionMessageRegExp /Unclosed "block" in ".*extractor(\/|\\)syntax_error\.twig" at line 1/
77+
* @dataProvider resourcesWithSyntaxErrorsProvider
7778
*/
78-
public function testExtractSyntaxError()
79+
public function testExtractSyntaxError($resources)
7980
{
8081
$twig = new \Twig_Environment(new \Twig_Loader_Array(array()));
8182
$twig->addExtension(new TranslationExtension($this->getMock('Symfony\Component\Translation\TranslatorInterface')));
8283

8384
$extractor = new TwigExtractor($twig);
84-
$extractor->extract(__DIR__.'/../Fixtures', new MessageCatalogue('en'));
85+
$extractor->extract($resources, new MessageCatalogue('en'));
86+
}
87+
88+
/**
89+
* @return array
90+
*/
91+
public function resourcesWithSyntaxErrorsProvider()
92+
{
93+
return array(
94+
array(__DIR__.'/../Fixtures'),
95+
array(__DIR__.'/../Fixtures/extractor/syntax_error.twig'),
96+
array(new \SplFileInfo(__DIR__.'/../Fixtures/extractor/syntax_error.twig')),
97+
);
8598
}
8699

87100
/**

src/Symfony/Bridge/Twig/Translation/TwigExtractor.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bridge\Twig\Translation;
1313

1414
use Symfony\Component\Finder\Finder;
15+
use Symfony\Component\Finder\SplFileInfo;
1516
use Symfony\Component\Translation\Extractor\AbstractFileExtractor;
1617
use Symfony\Component\Translation\Extractor\ExtractorInterface;
1718
use Symfony\Component\Translation\MessageCatalogue;
@@ -60,7 +61,11 @@ public function extract($resource, MessageCatalogue $catalogue)
6061
try {
6162
$this->extractTemplate(file_get_contents($file->getPathname()), $catalogue);
6263
} catch (\Twig_Error $e) {
63-
$e->setTemplateFile($file->getRelativePathname());
64+
if ($file instanceof SplFileInfo) {
65+
$e->setTemplateFile($file->getRelativePathname());
66+
} elseif ($file instanceof \SplFileInfo) {
67+
$e->setTemplateFile($file->getRealPath());
68+
}
6469

6570
throw $e;
6671
}

src/Symfony/Component/Asset/UrlPackage.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
class UrlPackage extends Package
3737
{
3838
private $baseUrls = array();
39-
private $sslUrls;
4039
private $sslPackage;
4140

4241
/**
@@ -62,7 +61,7 @@ public function __construct($baseUrls = array(), VersionStrategyInterface $versi
6261
$sslUrls = $this->getSslUrls($baseUrls);
6362

6463
if ($sslUrls && $baseUrls !== $sslUrls) {
65-
$this->sslPackage = new UrlPackage($sslUrls, $versionStrategy);
64+
$this->sslPackage = new self($sslUrls, $versionStrategy);
6665
}
6766
}
6867

src/Symfony/Component/Console/Output/ConsoleOutput.php

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,9 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
4646
*/
4747
public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
4848
{
49-
$outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
50-
$errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
51-
52-
parent::__construct(fopen($outputStream, 'w'), $verbosity, $decorated, $formatter);
49+
parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
5350

54-
$this->stderr = new StreamOutput(fopen($errorStream, 'w'), $verbosity, $decorated, $this->getFormatter());
51+
$this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
5552
}
5653

5754
/**
@@ -129,4 +126,24 @@ private function isRunningOS400()
129126
{
130127
return 'OS400' === php_uname('s');
131128
}
129+
130+
/**
131+
* @return resource
132+
*/
133+
private function openOutputStream()
134+
{
135+
$outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
136+
137+
return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
138+
}
139+
140+
/**
141+
* @return resource
142+
*/
143+
private function openErrorStream()
144+
{
145+
$errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
146+
147+
return fopen($errorStream, 'w');
148+
}
132149
}

src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ private function attemptSwitchUser(Request $request)
115115
if (false !== $originalToken) {
116116
if ($token->getUsername() === $request->get($this->usernameParameter)) {
117117
return $token;
118-
} else {
119-
throw new \LogicException(sprintf('You are already switched to "%s" user.', $token->getUsername()));
120118
}
119+
120+
throw new \LogicException(sprintf('You are already switched to "%s" user.', $token->getUsername()));
121121
}
122122

123123
if (false === $this->accessDecisionManager->decide($token, array($this->role))) {

src/Symfony/Component/Yaml/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
234234
}
235235

236236
// 1-liner optionally followed by newline(s)
237-
if ($this->lines[0] === trim($value)) {
237+
if (is_string($value) && $this->lines[0] === trim($value)) {
238238
try {
239239
$value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs);
240240
} catch (ParseException $e) {

src/Symfony/Component/Yaml/Tests/ParserTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,21 @@ public function testMappingInASequence()
551551
);
552552
}
553553

554+
/**
555+
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
556+
* @expectedExceptionMessage missing colon
557+
*/
558+
public function testScalarInSequence()
559+
{
560+
Yaml::parse(<<<EOF
561+
foo:
562+
- bar
563+
"missing colon"
564+
foo: bar
565+
EOF
566+
);
567+
}
568+
554569
/**
555570
* > It is an error for two equal keys to appear in the same mapping node.
556571
* > In such a case the YAML processor may continue, ignoring the second

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy