Skip to content

Commit 4fc9b9b

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: (64 commits) Show exception is checked twice in ExceptionController of twig allow SSI fragments configuration in XML files Display a better error message when the toolbar cannot be displayed render hidden _method field in form_rest() Add Doctrine Cache to dev dependencies to fix failing unit tests. return fallback locales whenever possible Fix Predis client cluster with pipeline [Dotenv] Test load() with multiple paths [Console] Fix catching exception type in QuestionHelper Improved the exception page when there is no message [WebProfilerBundle] Eliminate line wrap on count columnt (routing) [Validator] replace hardcoded service id [Routing] Fix XmlFileLoader exception message [DI] Dedup tags when using instanceof/autoconfigure [Translation] Fix FileLoader::loadResource() php doc Sessions: configurable "use_strict_mode" option for NativeSessionStorage [FrameworkBundle] [Command] Clean bundle directory, fixes #23177 fixed CS [WebProfilerBundle] Fix the icon for the Cache panel [WebServerBundle] Fix router script path and check existence ...
2 parents 4c63ff4 + 673523a commit 4fc9b9b

File tree

15 files changed

+108
-18
lines changed

15 files changed

+108
-18
lines changed

Command/AssetsInstallCommand.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
114114
$rows = array();
115115
$copyUsed = false;
116116
$exitCode = 0;
117+
$validAssetDirs = array();
117118
/** @var BundleInterface $bundle */
118119
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
119120
if (!is_dir($originDir = $bundle->getPath().'/Resources/public')) {
@@ -152,6 +153,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
152153
$exitCode = 1;
153154
$rows[] = array(sprintf('<fg=red;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage());
154155
}
156+
$validAssetDirs[] = $targetDir;
157+
}
158+
// remove the assets of the bundles that no longer exist
159+
foreach (new \FilesystemIterator($bundlesDir) as $dir) {
160+
if (!in_array($dir, $validAssetDirs)) {
161+
$filesystem->remove($dir);
162+
}
155163
}
156164

157165
$io->table(array('', 'Bundle', 'Method / Error'), $rows);

Command/CacheClearCommand.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr
158158
$safeTempKernel = str_replace('\\', '\\\\', get_class($tempKernel));
159159
$realKernelFQN = get_class($realKernel);
160160

161-
foreach (Finder::create()->files()->name('*.meta')->in($warmupDir) as $file) {
161+
foreach (Finder::create()->files()->depth('<3')->name('*.meta')->in($warmupDir) as $file) {
162162
file_put_contents($file, preg_replace(
163163
'/(C\:\d+\:)"'.$safeTempKernel.'"/',
164164
sprintf('$1"%s"', $realKernelFQN),
@@ -170,14 +170,16 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr
170170
$search = array($warmupDir, str_replace('\\', '\\\\', $warmupDir));
171171
$replace = str_replace('\\', '/', $realCacheDir);
172172
foreach (Finder::create()->files()->in($warmupDir) as $file) {
173-
$content = str_replace($search, $replace, file_get_contents($file));
174-
file_put_contents($file, $content);
173+
$content = str_replace($search, $replace, file_get_contents($file), $count);
174+
if ($count) {
175+
file_put_contents($file, $content);
176+
}
175177
}
176178

177179
// fix references to container's class
178180
$tempContainerClass = get_class($tempKernel->getContainer());
179181
$realContainerClass = get_class($realKernel->getContainer());
180-
foreach (Finder::create()->files()->name($tempContainerClass.'*')->in($warmupDir) as $file) {
182+
foreach (Finder::create()->files()->depth('<2')->name($tempContainerClass.'*')->in($warmupDir) as $file) {
181183
$content = str_replace($tempContainerClass, $realContainerClass, file_get_contents($file));
182184
file_put_contents($file, $content);
183185
rename($file, str_replace(DIRECTORY_SEPARATOR.$tempContainerClass, DIRECTORY_SEPARATOR.$realContainerClass, $file));

Controller/AbstractController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
1717
use Symfony\Component\Form\FormFactoryInterface;
1818
use Symfony\Component\HttpFoundation\RequestStack;
19-
use Symfony\Component\HttpFoundation\Session\Session;
2019
use Symfony\Component\HttpFoundation\Session\SessionInterface;
2120
use Symfony\Component\HttpKernel\HttpKernelInterface;
2221
use Symfony\Component\Routing\RouterInterface;
@@ -36,7 +35,10 @@ abstract class AbstractController implements ServiceSubscriberInterface
3635
{
3736
use ControllerTrait;
3837

39-
private $container;
38+
/**
39+
* @var ContainerInterface
40+
*/
41+
protected $container;
4042

4143
/**
4244
* @internal

DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
435435
->scalarNode('gc_divisor')->end()
436436
->scalarNode('gc_probability')->defaultValue(1)->end()
437437
->scalarNode('gc_maxlifetime')->end()
438+
->booleanNode('use_strict_mode')->end()
438439
->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
439440
->integerNode('metadata_update_threshold')
440441
->defaultValue('0')

DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
752752
// session storage
753753
$container->setAlias('session.storage', $config['storage_id']);
754754
$options = array();
755-
foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
755+
foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor', 'use_strict_mode') as $key) {
756756
if (isset($config[$key])) {
757757
$options[$key] = $config[$key];
758758
}

HttpCache/HttpCache.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ public function __construct(HttpKernelInterface $kernel, $cacheDir = null)
5454
protected function forward(Request $request, $raw = false, Response $entry = null)
5555
{
5656
$this->getKernel()->boot();
57-
$this->getKernel()->getContainer()->set('cache', $this);
58-
$this->getKernel()->getContainer()->set($this->getSurrogate()->getName(), $this->getSurrogate());
57+
$this->getKernel()->getContainer()->set('cache', $this); // to be removed in 4.0?
5958
6059
return parent::forward($request, $raw, $entry);
6160
}

Resources/config/schema/symfony-1.0.xsd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<xsd:element name="form" type="form" minOccurs="0" maxOccurs="1" />
1414
<xsd:element name="csrf-protection" type="csrf_protection" minOccurs="0" maxOccurs="1" />
1515
<xsd:element name="esi" type="esi" minOccurs="0" maxOccurs="1" />
16+
<xsd:element name="ssi" type="ssi" minOccurs="0" maxOccurs="1" />
1617
<xsd:element name="fragments" type="fragments" minOccurs="0" maxOccurs="1" />
1718
<xsd:element name="web-link" type="web_link" minOccurs="0" maxOccurs="1" />
1819
<xsd:element name="profiler" type="profiler" minOccurs="0" maxOccurs="1" />
@@ -58,6 +59,10 @@
5859
<xsd:attribute name="enabled" type="xsd:boolean" />
5960
</xsd:complexType>
6061

62+
<xsd:complexType name="ssi">
63+
<xsd:attribute name="enabled" type="xsd:boolean" />
64+
</xsd:complexType>
65+
6166
<xsd:complexType name="fragments">
6267
<xsd:attribute name="enabled" type="xsd:boolean" />
6368
<xsd:attribute name="path" type="xsd:string" />
@@ -110,6 +115,7 @@
110115
<xsd:attribute name="gc-maxlifetime" type="xsd:string" />
111116
<xsd:attribute name="gc-divisor" type="xsd:string" />
112117
<xsd:attribute name="gc-probability" type="xsd:string" />
118+
<xsd:attribute name="use-strict-mode" type="xsd:boolean" />
113119
<xsd:attribute name="save-path" type="xsd:string" />
114120
</xsd:complexType>
115121

Tests/Controller/AbstractControllerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Psr\Container\ContainerInterface;
1515
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
16-
use Symfony\Component\HttpFoundation\File\File;
1716

1817
class AbstractControllerTest extends ControllerTraitTest
1918
{

Tests/DependencyInjection/Fixtures/php/full.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
'esi' => array(
1414
'enabled' => true,
1515
),
16+
'ssi' => array(
17+
'enabled' => true,
18+
),
1619
'profiler' => array(
1720
'only_exceptions' => true,
1821
'enabled' => false,

Tests/DependencyInjection/Fixtures/xml/full.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<framework:csrf-protection field-name="_csrf"/>
1313
</framework:form>
1414
<framework:esi enabled="true" />
15+
<framework:ssi enabled="true" />
1516
<framework:profiler only-exceptions="true" enabled="false" />
1617
<framework:router resource="%kernel.root_dir%/config/routing.xml" type="xml" />
1718
<framework:session gc-maxlifetime="90000" gc-probability="1" gc-divisor="108" storage-id="session.storage.native" handler-id="session.handler.native_file" name="_SYMFONY" cookie-lifetime="86400" cookie-path="/" cookie-domain="example.com" cookie-secure="true" cookie-httponly="false" use-cookies="true" save-path="/path/to/sessions" />

0 commit comments

Comments
 (0)