Skip to content

Commit cd8ccff

Browse files
committed
Merge branch '2.6' into 2.7
* 2.6: [Yaml] throw a ParseException on invalid data type #15331 add infos about deprecated classes to UPGRADE-3.0 [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 6bb0c48 + 939c305 commit cd8ccff

File tree

6 files changed

+51
-9
lines changed

6 files changed

+51
-9
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ matrix:
1414
- php: 5.4
1515
- php: 5.5
1616
- php: 5.6
17-
- php: 5.3
1817
env: deps=low
1918
- php: 5.6
2019
env: deps=high

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/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)