Skip to content

Commit 14de848

Browse files
Merge branch '3.4'
* 3.4: bumped Symfony version to 3.4.0 updated VERSION for 3.4.0-BETA1 updated CHANGELOG for 3.4.0-BETA1 Do not process bindings in AbstractRecursivePass don't bind scalar values to controller method arguments Add extra autowiring aliases adding AdapterInterface alias for cache.app Adding a new debug:autowiring command [HttpFoundation] Make sessions secure and lazy [Routing] Ensure uniqueness without repeated check [Console] Sync ConsoleLogger::interpolate with the one in HttpKernel
2 parents 1f574b0 + d484f72 commit 14de848

File tree

50 files changed

+1908
-356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1908
-356
lines changed

CHANGELOG-3.4.md

Lines changed: 217 additions & 0 deletions
Large diffs are not rendered by default.

UPGRADE-3.4.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ Form
126126
FrameworkBundle
127127
---------------
128128

129+
* The `session.use_strict_mode` option has been deprecated and is enabled by default.
130+
129131
* The `cache:clear` command doesn't clear "app" PSR-6 cache pools anymore,
130132
but still clears "system" ones.
131133
Use the `cache:pool:clear` command to clear "app" pools instead.
@@ -235,18 +237,13 @@ HttpFoundation
235237
* The `Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler`
236238
class has been deprecated and will be removed in 4.0. Use the `\SessionHandler` class instead.
237239

238-
* The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy` class has been
239-
deprecated and will be removed in 4.0. Use your `\SessionHandlerInterface` implementation directly.
240+
* The `Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler` class has been
241+
deprecated and will be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or
242+
extend `AbstractSessionHandler` instead.
240243

241244
* The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` class has been
242245
deprecated and will be removed in 4.0. Use your `\SessionHandlerInterface` implementation directly.
243246

244-
* The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy` class has been
245-
deprecated and will be removed in 4.0. Use your `\SessionHandlerInterface` implementation directly.
246-
247-
* `NativeSessionStorage::setSaveHandler()` now takes an instance of `\SessionHandlerInterface` as argument.
248-
Not passing it is deprecated and will throw a `TypeError` in 4.0.
249-
250247
* Using `Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler` with the legacy mongo extension
251248
has been deprecated and will be removed in 4.0. Use it with the mongodb/mongodb package and ext-mongodb instead.
252249

UPGRADE-4.0.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,8 @@ Form
329329
FrameworkBundle
330330
---------------
331331

332+
* The `session.use_strict_mode` option has been removed and strict mode is always enabled.
333+
332334
* The `validator.mapping.cache.doctrine.apc` service has been removed.
333335

334336
* The "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter have been removed. Use the `Request::setTrustedProxies()` method in your front controller instead.
@@ -542,12 +544,11 @@ HttpFoundation
542544
* The ability to check only for cacheable HTTP methods using `Request::isMethodSafe()` is
543545
not supported anymore, use `Request::isMethodCacheable()` instead.
544546

545-
* The `Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler`,
546-
`Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy`,
547-
`Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` and
548-
`Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy` classes have been removed.
547+
* The `Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler` class has been
548+
removed. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.
549549

550-
* `NativeSessionStorage::setSaveHandler()` now requires an instance of `\SessionHandlerInterface` as argument.
550+
* The `Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler` and
551+
`Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` classes have been removed.
551552

552553
* The `Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler` does not work with the legacy
553554
mongo extension anymore. It requires mongodb/mongodb package and ext-mongodb.

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ CHANGELOG
2222
* Removed the "framework.validation.cache" configuration option. Configure the "cache.validator" service under "framework.cache.pools" instead.
2323
* Removed `PhpStringTokenParser`, use `Symfony\Component\Translation\Extractor\PhpStringTokenParser` instead.
2424
* Removed `PhpExtractor`, use `Symfony\Component\Translation\Extractor\PhpExtractor` instead.
25+
* Removed the `use_strict_mode` session option, it's is now enabled by default
2526

2627
3.4.0
2728
-----
2829

30+
* Session `use_strict_mode` is now enabled by default and the corresponding option has been deprecated
2931
* Made the `cache:clear` command to *not* clear "app" PSR-6 cache pools anymore,
3032
but to still clear "system" ones; use the `cache:pool:clear` command to clear "app" pools instead
3133
* Always register a minimalist logger that writes in `stderr`
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\FrameworkBundle\Command;
13+
14+
use Symfony\Component\Console\Input\InputArgument;
15+
use Symfony\Component\Console\Input\InputInterface;
16+
use Symfony\Component\Console\Output\OutputInterface;
17+
use Symfony\Component\Console\Style\SymfonyStyle;
18+
19+
/**
20+
* A console command for autowiring information.
21+
*
22+
* @author Ryan Weaver <[email protected]>
23+
*
24+
* @internal
25+
*/
26+
class DebugAutowiringCommand extends ContainerDebugCommand
27+
{
28+
protected static $defaultName = 'debug:autowiring';
29+
30+
/**
31+
* {@inheritdoc}
32+
*/
33+
protected function configure()
34+
{
35+
$this
36+
->setDefinition(array(
37+
new InputArgument('search', InputArgument::OPTIONAL, 'A search filter'),
38+
))
39+
->setDescription('Lists classes/interfaces you can use for autowiring')
40+
->setHelp(<<<'EOF'
41+
The <info>%command.name%</info> command displays all classes and interfaces that
42+
you can use as type-hints for autowiring:
43+
44+
<info>php %command.full_name%</info>
45+
46+
You can also pass a search term to filter the list:
47+
48+
<info>php %command.full_name% log</info>
49+
50+
EOF
51+
)
52+
;
53+
}
54+
55+
/**
56+
* {@inheritdoc}
57+
*/
58+
protected function execute(InputInterface $input, OutputInterface $output)
59+
{
60+
$io = new SymfonyStyle($input, $output);
61+
$errorIo = $io->getErrorStyle();
62+
63+
$builder = $this->getContainerBuilder();
64+
$serviceIds = $builder->getServiceIds();
65+
$serviceIds = array_filter($serviceIds, array($this, 'filterToServiceTypes'));
66+
67+
if ($search = $input->getArgument('search')) {
68+
$serviceIds = array_filter($serviceIds, function ($serviceId) use ($search) {
69+
return false !== stripos($serviceId, $search);
70+
});
71+
72+
if (empty($serviceIds)) {
73+
$errorIo->error(sprintf('No autowirable classes or interfaces found matching "%s"', $search));
74+
75+
return 1;
76+
}
77+
}
78+
79+
asort($serviceIds);
80+
81+
$io->title('Autowirable Services');
82+
$io->text('The following classes & interfaces can be used as type-hints when autowiring:');
83+
if ($search) {
84+
$io->text(sprintf('(only showing classes/interfaces matching <comment>%s</comment>)', $search));
85+
}
86+
$io->newLine();
87+
$tableRows = array();
88+
foreach ($serviceIds as $serviceId) {
89+
$tableRows[] = array(sprintf('<fg=cyan>%s</fg=cyan>', $serviceId));
90+
if ($builder->hasAlias($serviceId)) {
91+
$tableRows[] = array(sprintf(' alias to %s', $builder->getAlias($serviceId)));
92+
}
93+
}
94+
95+
$io->table(array(), $tableRows);
96+
}
97+
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,10 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
413413
->scalarNode('gc_divisor')->end()
414414
->scalarNode('gc_probability')->defaultValue(1)->end()
415415
->scalarNode('gc_maxlifetime')->end()
416-
->booleanNode('use_strict_mode')->end()
417416
->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
418417
->integerNode('metadata_update_threshold')
419418
->defaultValue('0')
420-
->info('seconds to wait between 2 session metadata updates, it will also prevent the session handler to write if the session has not changed')
419+
->info('seconds to wait between 2 session metadata updates')
421420
->end()
422421
->end()
423422
->end()

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
728728
// session storage
729729
$container->setAlias('session.storage', $config['storage_id'])->setPrivate(true);
730730
$options = array();
731-
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) {
731+
foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
732732
if (isset($config[$key])) {
733733
$options[$key] = $config[$key];
734734
}
@@ -742,14 +742,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
742742
$container->getDefinition('session.storage.native')->replaceArgument(1, null);
743743
$container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null);
744744
} else {
745-
$handlerId = $config['handler_id'];
746-
747-
if ($config['metadata_update_threshold'] > 0) {
748-
$container->getDefinition('session.handler.write_check')->addArgument(new Reference($handlerId));
749-
$handlerId = 'session.handler.write_check';
750-
}
751-
752-
$container->setAlias('session.handler', $handlerId)->setPrivate(true);
745+
$container->setAlias('session.handler', $config['handler_id'])->setPrivate(true);
753746
}
754747

755748
$container->setParameter('session.save_path', $config['save_path']);

src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,6 @@
111111
<service id="cache.global_clearer" parent="cache.default_clearer" public="true" />
112112
<service id="cache.app_clearer" alias="cache.default_clearer" public="true" />
113113
<service id="Psr\Cache\CacheItemPoolInterface" alias="cache.app" />
114+
<service id="Symfony\Component\Cache\Adapter\AdapterInterface" alias="cache.app" />
114115
</services>
115116
</container>

src/Symfony/Bundle/FrameworkBundle/Resources/config/console.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
<tag name="console.command" command="debug:container" />
5656
</service>
5757

58+
<service id="Symfony\Bundle\FrameworkBundle\Command\DebugAutowiringCommand">
59+
<tag name="console.command" command="debug:autowiring" />
60+
</service>
61+
5862
<service id="Symfony\Bundle\FrameworkBundle\Command\EventDispatcherDebugCommand">
5963
<argument type="service" id="event_dispatcher" />
6064
<tag name="console.command" command="debug:event-dispatcher" />

src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<service id="Symfony\Component\Routing\RouterInterface" alias="router" />
7878
<service id="Symfony\Component\Routing\Generator\UrlGeneratorInterface" alias="router" />
7979
<service id="Symfony\Component\Routing\Matcher\UrlMatcherInterface" alias="router" />
80+
<service id="Symfony\Component\Routing\RequestContextAwareInterface" alias="router" />
8081

8182
<service id="router.request_context" class="Symfony\Component\Routing\RequestContext">
8283
<argument>%router.request_context.base_url%</argument>

0 commit comments

Comments
 (0)