8000 Merge branch '2.7' into 2.8 · symfony/symfony@bddf9be · GitHub
[go: up one dir, main page]

Skip to content

Commit bddf9be

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: [TwigBundle] add back exception check Dont call count on non countable object
2 parents 9a9c3d1 + 7acc345 commit bddf9be

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected function findTemplate(Request $request, $format, $code, $showException
123123
// default to a generic HTML exception
124124
$request->setRequestFormat('html');
125125

126-
return sprintf('@Twig/Exception/%s.html.twig', $name);
126+
return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name);
127127
}
128128

129129
// to be removed when the minimum required version of Twig is >= 3.0

src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ public function testFallbackToHtmlIfNoTemplateForRequestedFormat()
4848
$this->assertEquals('html', $request->getRequestFormat());
4949
}
5050

51+
public function testFallbackToHtmlWithFullExceptionIfNoTemplateForRequestedFormatAndExceptionsShouldBeShown()
52+
{
53+
$twig = $this->createTwigEnv(array('TwigBundle:Exception:exception_full.html.twig' => '<html></html>'));
54+
55+
$request = $this->createRequest('txt');
56+
$request->attributes->set('showException', true);
57+
$exception = FlattenException::create(new \Exception());
58+
$controller = new ExceptionController($twig, false);
59+
60+
$controller->showAction($request, $exception);
61+
62+
$this->assertEquals('html', $request->getRequestFormat());
63+
}
64+
5165
public function testResponseHasRequestedMimeType()
5266
{
5367
$twig = $this->createTwigEnv(array('@Twig/Exception/error.json.twig' => '{}'));

src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
6262

6363
$resOffset = $this->getPosition($data);
6464

65-
$data .= pack('v', count($messages))
65+
$data .= pack('v', count($messages->all($domain)))
6666
.$indexes
6767
.$this->writePadding($data)
6868
.$resources
@@ -73,11 +73,11 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
7373
$root = pack('V7',
7474
$resOffset + (2 << 28), // Resource Offset + Resource Type
7575
6, // Index length
76-
$keyTop, // Index keys top
77-
$bundleTop, // Index resources top
78-
$bundleTop, // Index bundle top
79-
count($messages), // Index max table length
80-
0 // Index attributes
76+
$keyTop, // Index keys top
77+
$bundleTop, // Index resources top
78+
$bundleTop, // Index bundle top
79+
count($messages->all($domain)), // Index max table length
80+
0 // Index attributes
8181
);
8282

8383
$header = pack('vC2v4C12@32',

0 commit comments

Comments
 (0)
0