8000 Merge branch '2.3' into 2.4 · symfony/symfony@75179c7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 75179c7

Browse files
committed
Merge branch '2.3' into 2.4
* 2.3: PHP Fatal error when getContainer method of ContainerAwareCommand has be... [HttpFoundation] Fixed isSecure() check to be compliant with the docs Update MimeTypeExtensionGuesser.php fix test src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php Fixed the Travis build on PHP 5.3.3
2 parents ec1065a + 92d93ce commit 75179c7

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ before_script:
2323
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
2424
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
2525
- COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install
26-
- phpunit --self-update
26+
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "5.3.3" ]; then phpunit --self-update; fi;'
2727

2828
script:
2929
- ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo "Running {} tests"; phpunit --exclude-group tty,benchmark {};' || false

src/Symfony/Bundle/FrameworkBundle/Command/ContainerAwareCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,17 @@ abstract class ContainerAwareCommand extends Command implements ContainerAwareIn
2929

3030
/**
3131
* @return ContainerInterface
32+
* @throws \LogicException
3233
*/
3334
protected function getContainer()
3435
{
3536
if (null === $this->container) {
36-
$this->container = $this->getApplication()->getKernel()->getContainer();
37+
$application = $this->getApplication();
38+
if (null === $application) {
39+
throw new \LogicException('The container cannot be retrieved as the application instance is not yet set.');
40+
}
41+
42+
$this->container = $application->getKernel()->getContainer();
3743
}
3844

3945
return $this->container;

src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
723723
'text/plain' => 'txt',
724724
'text/prs.lines.tag' => 'dsc',
725725
'text/richtext' => 'rtx',
726+
'text/rtf' => 'rtf',
726727
'text/sgml' => 'sgml',
727728
'text/tab-separated-values' => 'tsv',
728729
'text/troff' => 't',

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,9 @@ public function isSecure()
11231123
return in_array(strtolower(current(explode(',', $proto))), array('https', 'on', 'ssl', '1'));
11241124
}
11251125

1126-
return 'on' == strtolower($this->server->get('HTTPS')) || 1 == $this->server->get('HTTPS');
1126+
$https = $this->server->get('HTTPS');
1127+
1128+
return !empty($https) && 'off' !== strtolower($https);
11271129
}
11281130

11291131
/**

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ class BinaryFileResponseTest extends ResponseTestCase
1919
{
2020
public function testConstruction()
2121
{
22-
$response = new BinaryFileResponse('README.md', 404, array('X-Header' => 'Foo'), true, null, true, true);
22+
$file = __DIR__ . '/../README.md';
23+
$response = new BinaryFileResponse($file, 404, array('X-Header' => 'Foo'), true, null, true, true);
2324
$this->assertEquals(404, $response->getStatusCode());
2425
$this->assertEquals('Foo', $response->headers->get('X-Header'));
2526
$this->assertTrue($response->headers->has('ETag'));
2627
$this->assertTrue($response->headers->has('Last-Modified'));
2728
$this->assertFalse($response->headers->has('Content-Disposition'));
2829

29-
$response = BinaryFileResponse::create('README.md', 404, array(), true, ResponseHeaderBag::DISPOSITION_INLINE);
30+
$response = BinaryFileResponse::create($file, 404, array(), true, ResponseHeaderBag::DISPOSITION_INLINE);
3031
$this->assertEquals(404, $response->getStatusCode());
3132
$this->assertFalse($response->headers->has('ETag'));
3233
$this->assertEquals('inline; filename="README.md"', $response->headers->get('Content-Disposition'));
@@ -37,13 +38,13 @@ public function testConstruction()
3738
*/
3839
public function testSetContent()
3940
{
40-
$response = new BinaryFileResponse('README.md');
41+
$response = new BinaryFileResponse(__FILE__);
4142
$response->setContent('foo');
4243
}
4344

4445
public function testGetContent()
4546
{
46-
$response = new BinaryFileResponse('README.md');
47+
$response = new BinaryFileResponse(__FILE__);
4748
$this->assertFalse($response->getContent());
4849
}
4950

@@ -160,7 +161,7 @@ public function testXSendfile()
160161
$request->headers->set('X-Sendfile-Type', 'X-Sendfile');
161162

162163
BinaryFileResponse::trustXSendfileTypeHeader();
163-
$response = BinaryFileResponse::create('README.md');
164+
$response = BinaryFileResponse::create(__DIR__ . '/../README.md');
164165
$response->prepare($request);
165166

166167
$this->expectOutputString('');
@@ -187,9 +188,12 @@ public function testXAccelMapping($realpath, $mapping, $virtual)
187188
$file->expects($this->any())
188189
->method('isReadable')
189190
->will($this->returnValue(true));
191+
$file->expects($this->any())
192+
->method('getMT 8D13 ime')
193+
->will($this->returnValue(time()));
190194

191195
BinaryFileResponse::trustXSendFileTypeHeader();
192-
$response = new BinaryFileResponse('README.md');
196+
$response = new BinaryFileResponse($file);
193197
$reflection = new \ReflectionObject($response);
194198
$property = $reflection->getProperty('file');
195199
$property->setAccessible(true);
@@ -209,6 +213,6 @@ public function getSampleXAccelMappings()
209213

210214
protected function provideResponse()
211215
{
212-
return new BinaryFileResponse('README.md');
216+
return new BinaryFileResponse(__DIR__ . '/../README.md');
213217
}
214218
}

0 commit comments

Comments
 (0)
0