Skip to content

Commit 0bc5eea

Browse files
Merge branch '2.7' into 2.8
* 2.7: [Yaml] release memory after parsing [HttpFoundation] Fix and test status codes according to IANA's data Add `use_strict_mode` in validOptions for session [Console] Inherit phpdoc from OutputFormatterInterface
2 parents 54fa2ff + f478161 commit 0bc5eea

File tree

6 files changed

+78
-29
lines changed

6 files changed

+78
-29
lines changed

src/Symfony/Component/Console/Formatter/OutputFormatter.php

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -81,56 +81,39 @@ public function __construct($decorated = false, array $styles = array())
8181
}
8282

8383
/**
84-
* Sets the decorated flag.
85-
*
86-
* @param bool $decorated Whether to decorate the messages or not
84+
* {@inheritdoc}
8785
*/
8886
public function setDecorated($decorated)
8987
{
9088
$this->decorated = (bool) $decorated;
9189
}
9290

9391
/**
94-
* Gets the decorated flag.
95-
*
96-
* @return bool true if the output will decorate messages, false otherwise
92+
* {@inheritdoc}
9793
*/
9894
public function isDecorated()
9995
{
10096
return $this->decorated;
10197
}
10298

10399
/**
104-
* Sets a new style.
105-
*
106-
* @param string $name The style name
107-
* @param OutputFormatterStyleInterface $style The style instance
100+
* {@inheritdoc}
108101
*/
109102
public function setStyle($name, OutputFormatterStyleInterface $style)
110103
{
111104
$this->styles[strtolower($name)] = $style;
112105
}
113106

114107
/**
115-
* Checks if output formatter has style with specified name.
116-
*
117-
* @param string $name
118-
*
119-
* @return bool
108+
* {@inheritdoc}
120109
*/
121110
public function hasStyle($name)
122111
{
123112
return isset($this->styles[strtolower($name)]);
124113
}
125114

126115
/**
127-
* Gets style options from style with specified name.
128-
*
129-
* @param string $name
130-
*
131-
* @return OutputFormatterStyleInterface
132-
*
133-
* @throws InvalidArgumentException When style isn't defined
116+
* {@inheritdoc}
134117
*/
135118
public function getStyle($name)
136119
{
@@ -142,11 +125,7 @@ public function getStyle($name)
142125
}
143126

144127
/**
145-
* Formats a message according to the given styles.
146-
*
147-
* @param string $message The message to style
148-
*
149-
* @return string The styled message
128+
* {@inheritdoc}
150129
*/
151130
public function format($message)
152131
{

src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public function hasStyle($name);
5555
* @param string $name
5656
*
5757
* @return OutputFormatterStyleInterface
58+
*
59+
* @throws \InvalidArgumentException When style isn't defined
5860
*/
5961
public function getStyle($name);
6062

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class Response
179179
503 => 'Service Unavailable',
180180
504 => 'Gateway Timeout',
181181
505 => 'HTTP Version Not Supported',
182-
506 => 'Variant Also Negotiates (Experimental)', // RFC2295
182+
506 => 'Variant Also Negotiates', // RFC2295
183183
507 => 'Insufficient Storage', // RFC4918
184184
508 => 'Loop Detected', // RFC5842
185185
510 => 'Not Extended', // RFC2774

src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class NativeSessionStorage implements SessionStorageInterface
8181
* name, "PHPSESSID"
8282
* referer_check, ""
8383
* serialize_handler, "php"
84+
* use_strict_mode, "0"
8485
* use_cookies, "1"
8586
* use_only_cookies, "1"
8687
* use_trans_sid, "0"
@@ -331,7 +332,7 @@ public function setOptions(array $options)
331332
'entropy_file', 'entropy_length', 'gc_divisor',
332333
'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',
333334
'hash_function', 'name', 'referer_check',
334-
'serialize_handler', 'use_cookies',
335+
'serialize_handler', 'use_strict_mode', 'use_cookies',
335336
'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled',
336337
'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name',
337338
'upload_progress.freq', 'upload_progress.min-freq', 'url_rewriter.tags',

src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,67 @@ protected function provideResponse()
884884
{
885885
return new Response();
886886
}
887+
888+
/**
889+
* @see http://github.com/zendframework/zend-diactoros for the canonical source repository
890+
*
891+
* @author Fábio Pacheco
892+
* @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com)
893+
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
894+
*/
895+
public function ianaCodesReasonPhrasesProvider()
896+
{
897+
if (!in_array('https', stream_get_wrappers(), true)) {
898+
$this->markTestSkipped('The "https" wrapper is not available');
899+
}
900+
901+
$ianaHttpStatusCodes = new \DOMDocument();
902+
903+
libxml_set_streams_context(stream_context_create(array(
904+
'http' => array(
905+
'method' => 'GET',
906+
'timeout' => 30,
907+
),
908+
)));
909+
910+
$ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml');
911+
if (!$ianaHttpStatusCodes->relaxNGValidate('https://www.iana.org/assignments/http-status-codes/http-status-codes.rng')) {
912+
self::fail('Invalid IANA\'s HTTP status code list.');
913+
}
914+
915+
$ianaCodesReasonPhrases = array();
916+
917+
$xpath = new \DomXPath($ianaHttpStatusCodes);
918+
$xpath->registerNamespace('ns', 'http://www.iana.org/assignments');
919+
920+
$records = $xpath->query('//ns:record');
921+
foreach ($records as $record) {
922+
$value = $xpath->query('.//ns:value', $record)->item(0)->nodeValue;
923+
$description = $xpath->query('.//ns:description', $record)->item(0)->nodeValue;
924+
925+
if (in_array($description, array('Unassigned', '(Unused)'), true)) {
926+
continue;
927+
}
928+
929+
if (preg_match('/^([0-9]+)\s*\-\s*([0-9]+)$/', $value, $matches)) {
930+
for ($value = $matches[1]; $value <= $matches[2]; ++$value) {
931+
$ianaCodesReasonPhrases[] = array($value, $description);
932+
}
933+
} else {
934+
$ianaCodesReasonPhrases[] = array($value, $description);
935+
}
936+
}
937+
938+
return $ianaCodesReasonPhrases;
939+
}
940+
941+
/**
942+
* @dataProvider ianaCodesReasonPhrasesProvider
943+
*/
944+
public function testReasonPhraseDefaultsAgainstIana($code, $reasonPhrase)
945+
{
946+
$this->assertEquals($reasonPhrase, Response::$statusTexts[$code]);
947+
}
887948
}
888949

889950
class StringableObject

src/Symfony/Component/Yaml/Parser.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
8686
mb_internal_encoding($mbEncoding);
8787
}
8888

89+
$this->lines = array();
90+
$this->currentLine = '';
91+
$this->refs = array();
92+
$this->skippedLineNumbers = array();
93+
$this->locallySkippedLineNumbers = array();
94+
8995
if (null !== $e) {
9096
throw $e;
9197
}

0 commit comments

Comments
 (0)