Skip to content

Commit fac882c

Browse files
Merge branch '3.4'
* 3.4: [HttpKernel] Disable container inlining when legacy inlining has been used Let getFlashes starts the session Update default translations path [FrameworkBundle] Ignore failures when removing the old cache dir
2 parents 184a40a + 72a204e commit fac882c

File tree

10 files changed

+18
-19
lines changed

10 files changed

+18
-19
lines changed

src/Symfony/Bridge/Twig/AppVariable.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,9 @@ public function getDebug()
156156
*/
157157
public function getFlashes($types = null)
158158
{
159-
// needed to avoid starting the session automatically when looking for flash messages
160159
try {
161160
$session = $this->getSession();
162-
if (null === $session || !$session->isStarted()) {
161+
if (null === $session) {
163162
return array();
164163
}
165164
} catch (\RuntimeException $e) {

src/Symfony/Bridge/Twig/Tests/AppVariableTest.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,8 @@ public function testGetFlashesWithNoRequest()
173173
*/
174174
public function testGetFlashesWithNoSessionStarted()
175175
{
176-
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
177-
$request->method('getSession')->willReturn(new Session());
178-
179-
$this->setRequestStack($request);
180-
181-
$this->assertEquals(array(), $this->appVariable->getFlashes());
176+
$flashMessages = $this->setFlashMessages(false);
177+
$this->assertEquals($flashMessages, $this->appVariable->getFlashes());
182178
}
183179

184180
/**
@@ -256,7 +252,7 @@ protected function setTokenStorage($user)
256252
$token->method('getUser')->willReturn($user);
257253
}
258254

259-
private function setFlashMessages()
255+
private function setFlashMessages($sessionHasStarted = true)
260256
{
261257
$flashMessages = array(
262258
'notice' => array('Notice #1 message'),
@@ -266,8 +262,8 @@ private function setFlashMessages()
266262
$flashBag = new FlashBag();
267263
$flashBag->initialize($flashMessages);
268264

269-
$session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->getMock();
270-
$session->method('isStarted')->willReturn(true);
265+
$session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->disableOriginalConstructor()->getMock();
266+
$session->method('isStarted')->willReturn($sessionHasStarted);
271267
$session->method('getFlashBag')->willReturn($flashBag);
272268

273269
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\Console\Output\OutputInterface;
1818
use Symfony\Component\Console\Style\SymfonyStyle;
1919
use Symfony\Component\EventDispatcher\EventDispatcher;
20+
use Symfony\Component\Filesystem\Exception\IOException;
2021
use Symfony\Component\Filesystem\Filesystem;
2122
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
2223
use Symfony\Component\HttpKernel\RebootableInterface;
@@ -104,7 +105,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
104105
$io->comment('Removing old cache directory...');
105106
}
106107

107-
$this->filesystem->remove($oldCacheDir);
108+
try {
109+
$this->filesystem->remove($oldCacheDir);
110+
} catch (IOException $e) {
111+
$io->warning($e->getMessage());
112+
}
108113

109114
if ($output->isVerbose()) {
110115
$io->comment('Finished');

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode)
626626
->scalarNode('formatter')->defaultValue('translator.formatter.default')->end()
627627
->scalarNode('default_path')
628628
->info('The default path used to load translations')
629-
->defaultValue('%kernel.project_dir%/config/translations')
629+
->defaultValue('%kernel.project_dir%/translations')
630630
->end()
631631
->arrayNode('paths')
632632
->prototype('scalar')->end()

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ protected static function getBundleDefaultConfig()
155155
'logging' => true,
156156
'formatter' => 'translator.formatter.default',
157157
'paths' => array(),
158-
'default_path' => '%kernel.project_dir%/config/translations',
158+
'default_path' => '%kernel.project_dir%/translations',
159159
),
160160
'validation' => array(
161161
'enabled' => !class_exists(FullStack::class),

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ framework:
4242
translator:
4343
enabled: true
4444
fallback: fr
45-
default_path: '%kernel.root_dir%/config/translations'
45+
default_path: '%kernel.root_dir%/translations'
4646
paths: ['%kernel.root_dir%/Fixtures/translations']
4747
validation:
4848
enabled: true

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ public function testTranslator()
496496
'->registerTranslatorConfiguration() finds translation resources in custom paths'
497497
);
498498
$this->assertContains(
499-
strtr(__DIR__.'/config/translations/test_default.en.xlf', '/', DIRECTORY_SEPARATOR),
499+
strtr(__DIR__.'/translations/test_default.en.xlf', '/', DIRECTORY_SEPARATOR),
500500
$files,
501501
'->registerTranslatorConfiguration() finds translation resources in default path'
502502
);

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ public function dump(array $options = array())
121121
'namespace' => '',
122122
'as_files' => false,
123123
'debug' => true,
124-
'hot_path_tag' => null,
124+
'hot_path_tag' => 'container.hot_path',
125125
'inline_class_loader_parameter' => 'container.dumper.inline_class_loader',
126126
), $options);
127127

128128
$this->namespace = $options['namespace'];
129129
$this->asFiles = $options['as_files'];
130130
$this->hotPathTag = $options['hot_path_tag'];
131-
$this->inlineRequires = $this->container->hasParameter($options['inline_class_loader_parameter']) && $this->container->getParameter($options['inline_class_loader_parameter']);
131+
$this->inlineRequires = $options['inline_class_loader_parameter'] && $this->container->hasParameter($options['inline_class_loader_parameter']) && $this->container->getParameter($options['inline_class_loader_parameter']);
132132

133133
if (0 !== strpos($baseClass = $options['base_class'], '\\') && 'Container' !== $baseClass) {
134134
$baseClass = sprintf('%s\%s', $options['namespace'] ? '\\'.$options['namespace'] : '', $baseClass);

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container
657657
'file' => $cache->getPath(),
658658
'as_files' => true,
659659
'debug' => $this->debug,
660-
'hot_path_tag' => 'container.hot_path',
661660
));
662661

663662
$rootCode = array_pop($content);

0 commit comments

Comments
 (0)