8000 Merge branch '2.4' into 2.5 · symfony/symfony@17009c1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 17009c1

Browse files
committed
Merge branch '2.4' into 2.5
* 2.4: added missing test fixed CS [HttpFoundation] Remove content-related headers if content is empty bumped Symfony version to 2.4.8 removed defaults from PHPUnit configuration Conflicts: src/Symfony/Component/HttpKernel/Kernel.php
2 parents 50a210b + 1edd1c7 commit 17009c1

File tree

39 files changed

+32
-248
lines changed

39 files changed

+32
-248
lines changed

phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="autoload.php.dist"
148
>
159
<php>

src/Symfony/Bridge/Doctrine/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="Tests/bootstrap.php"
148
>
159
<testsuites>

src/Symfony/Bridge/Monolog/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Bridge/Propel1/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Bridge/ProxyManager/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Bridge/Twig/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159

src/Symfony/Bundle/TwigBundle/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159

src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159

src/Symfony/Component/BrowserKit/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Component/ClassLoader/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Component/Config/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Component/Console/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Component/CssSelector/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Component/Debug/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Component/DependencyInjection/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Component/DomCrawler/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Component/EventDispatcher/phpunit.xml.dist

Copy file name to clipboard
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Component/Filesystem/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Component/Finder/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Component/Form/phpunit.xml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false"
137
bootstrap="vendor/autoload.php"
148
>
159
<testsuites>

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -270,36 +270,38 @@ public function prepare(Request $request)
270270

271271
if ($this->isInformational() || in_array($this->statusCode, array(204, 304))) {
272272
$this->setContent(null);
273-
}
274-
275-
// Content-type based on the Request
276-
if (!$headers->has('Content-Type')) {
277-
$format = $request->getRequestFormat();
278-
if (null !== $format && $mimeType = $request->getMimeType($format)) {
279-
$headers->set('Content-Type', $mimeType);
273+
$headers->remove('Content-Type');
274+
$headers->remove('Content-Length');
275+
} else {
276+
// Content-type based on the Request
277+
if (!$headers->has('Content-Type')) {
278+
$format = $request->getRequestFormat();
279+
if (null !== $format && $mimeType = $request->getMimeType($format)) {
280+
$headers->set('Content-Type', $mimeType);
281+
}
280282
}
281-
}
282283

283-
// Fix Content-Type
284-
$charset = $this->charset ?: 'UTF-8';
285-
if (!$headers->has('Content-Type')) {
286-
$headers->set('Content-Type', 'text/html; charset='.$charset);
287-
} elseif (0 === stripos($headers->get('Content-Type'), 'text/') && false === stripos($headers->get('Content-Type'), 'charset')) {
288-
// add the charset
289-
$headers->set('Content-Type', $headers->get('Content-Type').'; charset='.$charset);
290-
}
284+
// Fix Content-Type
285+
$charset = $this->charset ?: 'UTF-8';
286+
if (!$headers->has('Content-Type')) {
287+
$headers->set('Content-Type', 'text/html; charset=' . $charset);
288+
} elseif (0 === stripos($headers->get('Content-Type'), 'text/') && false === stripos($headers->get('Content-Type'), 'charset')) {
289+
// add the charset
290+
$headers->set('Content-Type', $headers->get('Content-Type') . '; charset=' . $charset);
291+
}
291292

292-
// Fix Content-Length
293-
if ($headers->has('Transfer-Encoding')) {
294-
$headers->remove('Content-Length');
295-
}
293+
// Fix Content-Length
294+
if ($headers->has('Transfer-Encoding')) {
295+
$headers->remove('Content-Length');
296+
}
296297

297-
if ($request->isMethod('HEAD')) {
298-
// cf. RFC2616 14.13
299-
$length = $headers->get('Content-Length');
300-
$this->setContent(null);
301-
if ($length) {
302-
$headers->set('Content-Length', $length);
298+
if ($request->isMethod('HEAD')) {
299+
// cf. RFC2616 14.13
300+
$length = $headers->get('Content-Length');
301+
$this->setContent(null);
302+
if ($length) {
303+
$headers->set('Content-Length', $length);
304+
}
303305
}
304306
}
305307

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,15 @@ public function testPrepareRemovesContentForInformationalResponse()
445445
$response->setStatusCode(101);
446446
$response->prepare($request);
447447
$this->assertEquals('', $response->getContent());
448+
$this->assertFalse($response->headers->has('Content-Type'));
449+
$this->assertFalse($response->headers->has('Content-Length'));
448450

449451
$response->setContent('content');
450452
$response->setStatusCode(304);
451453
$response->prepare($request);
452454
$this->assertEquals('', $response->getContent());
455+
$this->assertFalse($response->headers->has('Content-Type'));
456+
$this->assertFalse($response->headers->has('Content-Length'));
453457
}
454458

455459
public function testPrepareRemovesContentLength()

0 commit comments

Comments
 (0)
0