Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 522d079

Browse files
Merge branch '3.4'
* 3.4: [Bridge\Doctrine][FrameworkBundle] Deprecate some remaining uses of ContainerAwareTrait [FrameworkBundle] Fix bad interface hint in AbstractController [VarDumper] deprecate MongoCaster [HttpFoundation] deprecate using with the legacy mongo extension; use it with the mongodb/mongodb package and ext-mongodb instead Fix BC layer Reset profiler. [DI] Improve some deprecation messages [DI] remove inheritdoc from dumped container [Config] Fix dumped files invalidation by OPCache [Security] Add Guard authenticator <supports> method [Cache] Fix race condition in TagAwareAdapter [DI] Allow setting any public non-initialized services [Yaml] parse references on merge keys treat trailing backslashes in multi-line strings [FrameworkBundle] Expose dotenv in bin/console about fix refreshing line numbers for the inline parser fix version in changelog [FrameworkBundle] Make Controller helpers final [DoctrineBridge] Deprecate DbalSessionHandler
2 parents 7c74f09 + c674bd7 commit 522d079

File tree

104 files changed

+1272
-544
lines changed

Some content is hidden

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

104 files changed

+1272
-544
lines changed

UPGRADE-3.4.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ Debug
6363

6464
* Support for stacked errors in the `ErrorHandler` is deprecated and will be removed in Symfony 4.0.
6565

66+
EventDispatcher
67+
---------------
68+
69+
* Implementing `TraceableEventDispatcherInterface` without the `reset()` method
70+
is deprecated and will be unsupported in 4.0.
71+
6672
Filesystem
6773
----------
6874

@@ -234,6 +240,9 @@ HttpFoundation
234240
* `NativeSessionStorage::setSaveHandler()` now takes an instance of `\SessionHandlerInterface` as argument.
235241
Not passing it is deprecated and will throw a `TypeError` in 4.0.
236242

243+
* Using `Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler` with the legacy mongo extension
244+
has been deprecated and will be removed in 4.0. Use it with the mongodb/mongodb package and ext-mongodb instead.
245+
237246
HttpKernel
238247
----------
239248

@@ -270,6 +279,10 @@ HttpKernel
270279

271280
* The `Symfony\Component\HttpKernel\Config\EnvParametersResource` class has been deprecated and will be removed in 4.0.
272281

282+
* Implementing `DataCollectorInterface` without a `reset()` method has been deprecated and will be unsupported in 4.0.
283+
284+
* Implementing `DebugLoggerInterface` without a `clear()` method has been deprecated and will be unsupported in 4.0.
285+
273286
* The `ChainCacheClearer::add()` method has been deprecated and will be removed in 4.0,
274287
inject the list of clearers as a constructor argument instead.
275288

@@ -295,6 +308,9 @@ Security
295308
* Deprecated the HTTP digest authentication: `NonceExpiredException`,
296309
`DigestAuthenticationListener` and `DigestAuthenticationEntryPoint` will be
297310
removed in 4.0. Use another authentication system like `http_basic` instead.
311+
312+
* The `GuardAuthenticatorInterface` has been deprecated and will be removed in 4.0.
313+
Use `AuthenticatorInterface` instead.
298314

299315
SecurityBundle
300316
--------------
@@ -320,11 +336,11 @@ SecurityBundle
320336

321337
* Deprecated the HTTP digest authentication: `HttpDigestFactory` will be removed in 4.0.
322338
Use another authentication system like `http_basic` instead.
323-
339+
324340
* Deprecated setting the `switch_user.stateless` option to false when the firewall is `stateless`.
325341
Setting it to false will have no effect in 4.0.
326342

327-
* Not configuring explicitly the provider on a firewall is ambiguous when there is more than one registered provider.
343+
* Not configuring explicitly the provider on a firewall is ambiguous when there is more than one registered provider.
328344
Using the first configured provider is deprecated since 3.4 and will throw an exception on 4.0.
329345
Explicitly configure the provider to use on your firewalls.
330346

UPGRADE-4.0.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ EventDispatcher
192192
* The `ContainerAwareEventDispatcher` class has been removed.
193193
Use `EventDispatcher` with closure factories instead.
194194

195+
* The `reset()` method has been added to `TraceableEventDispatcherInterface`.
196+
195197
ExpressionLanguage
196198
------------------
197199

@@ -540,6 +542,9 @@ HttpFoundation
540542

541543
* `NativeSessionStorage::setSaveHandler()` now requires an instance of `\SessionHandlerInterface` as argument.
542544

545+
* The `Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler` does not work with the legacy
546+
mongo extension anymore. It requires mongodb/mongodb package and ext-mongodb.
547+
543548
HttpKernel
544549
----------
545550

@@ -611,6 +616,10 @@ HttpKernel
611616

612617
* The `Symfony\Component\HttpKernel\Config\EnvParametersResource` class has been removed.
613618

619+
* The `reset()` method has been added to `Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface`.
620+
621+
* The `clear()` method has been added to `Symfony\Component\HttpKernel\Log\DebugLoggerInterface`.
622+
614623
* The `ChainCacheClearer::add()` method has been removed,
615624
inject the list of clearers as a constructor argument instead.
616625

@@ -673,6 +682,9 @@ Security
673682
`DigestAuthenticationListener` and `DigestAuthenticationEntryPoint` classes
674683
have been removed. Use another authentication system like `http_basic` instead.
675684

685+
* The `GuardAuthenticatorInterface` interface has been removed.
686+
Use `AuthenticatorInterface` instead.
687+
676688
SecurityBundle
677689
--------------
678690

@@ -693,10 +705,10 @@ SecurityBundle
693705

694706
* Removed the HTTP digest authentication system. The `HttpDigestFactory` class
695707
has been removed. Use another authentication system like `http_basic` instead.
696-
708+
697709
* The `switch_user.stateless` option is now always true if the firewall is stateless.
698710

699-
* Not configuring explicitly the provider on a firewall is ambiguous when there is more than one registered provider.
711+
* Not configuring explicitly the provider on a firewall is ambiguous when there is more than one registered provider.
700712
The first configured provider is not used anymore and an exception is thrown instead.
701713
Explicitly configure the provider to use on your firewalls.
702714

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"ext-xml": "*",
2121
"doctrine/common": "~2.4",
2222
"fig/link-util": "^1.0",
23-
"twig/twig": "~1.34|~2.4",
23+
"twig/twig": "^1.35|^2.4.4",
2424
"psr/cache": "~1.0",
2525
"psr/container": "^1.0",
2626
"psr/link": "^1.0",

src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ class DoctrineDataCollector extends DataCollector
2828
private $registry;
2929
private $connections;
3030
private $managers;
31+
32+
/**
33+
* @var DebugStack[]
34+
*/
3135
private $loggers = array();
3236

3337
public function __construct(ManagerRegistry $registry)
@@ -65,6 +69,16 @@ public function collect(Request $request, Response $response, \Exception $except
6569
);
6670
}
6771

72+
public function reset()
73+
{
74+
$this->data = array();
75+
76+
foreach ($this->loggers as $logger) {
77+
$logger->queries = array();
78+
$logger->currentQuery = 0;
79+
}
80+
}
81+
6882
public function getManagers()
6983
{
7084
return $this->data['managers'];

src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bridge\Doctrine\HttpFoundation;
1313

14+
@trigger_error(sprintf('The class %s is deprecated since version 3.4 and will be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler instead.', DbalSessionHandler::class), E_USER_DEPRECATED);
15+
1416
use Doctrine\DBAL\Connection;
1517
use Doctrine\DBAL\Driver\DriverException;
1618
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
@@ -25,6 +27,8 @@
2527
* @author Fabien Potencier <[email protected]>
2628
* @author Johannes M. Schmitt <[email protected]>
2729
* @author Tobias Schultze <http://tobion.de>
30+
*
31+
* @deprecated since version 3.4, to be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler instead.
2832
*/
2933
class DbalSessionHandler implements \SessionHandlerInterface
3034
{

src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandlerSchema.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@
1111

1212
namespace Symfony\Bridge\Doctrine\HttpFoundation;
1313

14+
@trigger_error(sprintf('The class %s is deprecated since version 3.4 and will be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler::createTable instead.', DbalSessionHandlerSchema::class), E_USER_DEPRECATED);
15+
1416
use Doctrine\DBAL\Schema\Schema;
1517

1618
/**
1719
* DBAL Session Storage Schema.
1820
*
1921
* @author Johannes M. Schmitt <[email protected]>
22+
*
23+
* @deprecated since version 3.4, to be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler::createTable instead.
2024
*/
2125
final class DbalSessionHandlerSchema extends Schema
2226
{

src/Symfony/Bridge/Doctrine/ManagerRegistry.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
namespace Symfony\Bridge\Doctrine;
1313

1414
use ProxyManager\Proxy\LazyLoadingInterface;
15+
use Psr\Container\ContainerInterface;
1516
use Symfony\Component\DependencyInjection\Container;
1617
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
17-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
18+
use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface;
1819
use Doctrine\Common\Persistence\AbstractManagerRegistry;
1920

2021
/**
@@ -24,7 +25,21 @@
2425
*/
2526
abstract class ManagerRegistry extends AbstractManagerRegistry implements ContainerAwareInterface
2627
{
27-
use ContainerAwareTrait;
28+
/**
29+
* @var ContainerInterface
30+
*/
31+
protected $container;
32+
33+
/**
34+
* @deprecated since version 3.4, to be removed in 4.0 alongside with the ContainerAwareInterface type.
35+
* @final since version 3.4
36+
*/
37+
public function setContainer(SymfonyContainerInterface $container = null)
38+
{
39+
@trigger_error(sprintf('The "%s()" method is deprecated since version 3.4 and will be removed in 4.0. Inject a PSR-11 container using the constructor instead.', __METHOD__), E_USER_DEPRECATED);
40+
41+
$this->container = $container;
42+
}
2843

2944
/**
3045
* {@inheritdoc}

src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ public function testCollectQueryWithNoParams()
101101
$this->assertTrue($collectedQueries['default'][1]['explainable']);
102102
}
103103

104+
public function testReset()
105+
{
106+
$queries = array(
107+
array('sql' => 'SELECT * FROM table1', 'params' => array(), 'types' => array(), 'executionMS' => 1),
108+
);
109+
$c = $this->createCollector($queries);
110+
$c->collect(new Request(), new Response());
111+
112+
$c->reset();
113+
$c->collect(new Request(), new Response());
114+
115+
$this->assertEquals(array('default' => array()), $c->getQueries());
116+
}
117+
104118
/**
105119
* @dataProvider paramProvider
106120
*/

src/Symfony/Bridge/Doctrine/Tests/HttpFoundation/DbalSessionHandlerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* Test class for DbalSessionHandler.
1919
*
2020
* @author Drak <[email protected]>
21+
*
22+
* @group legacy
2123
*/
2224
class DbalSessionHandlerTest extends TestCase
2325
{

src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testResetService()
3131
$container = new \LazyServiceProjectServiceContainer();
3232

3333
$registry = new TestManagerRegistry('name', array(), array('defaultManager' => 'foo'), 'defaultConnection', 'defaultManager', 'proxyInterfaceName');
34-
$registry->setContainer($container);
34+
$registry->setTestContainer($container);
3535

3636
$foo = $container->get('foo');
3737
$foo->bar = 123;
@@ -46,6 +46,11 @@ public function testResetService()
4646

4747
class TestManagerRegistry extends ManagerRegistry
4848
{
49+
public function setTestContainer($container)
50+
{
51+
$this->container = $container;
52+
}
53+
4954
public function getAliasNamespace($alias)
5055
{
5156
return 'Foo';

src/Symfony/Bridge/Monolog/Logger.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ public function countErrors()
4545
return 0;
4646
}
4747

48+
/**
49+
* {@inheritdoc}
50+
*/
51+
public function clear()
52+
{
53+
if (($logger = $this->getDebugLogger()) && method_exists($logger, 'clear')) {
54+
$logger->clear();
55+
}
56+
}
57+
4858
/**
4959
* Returns a DebugLoggerInterface instance if one is registered with this logger.
5060
*

src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,13 @@ public function countErrors()
5555
{
5656
return $this->errorCount;
5757
}
58+
59+
/**
60+
* {@inheritdoc}
61+
*/
62+
public function clear()
63+
{
64+
$this->records = array();
65+
$this->errorCount = 0;
66+
}
5867
}

src/Symfony/Bridge/Monolog/Tests/LoggerTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,17 @@ public function testGetLogsWithDebugProcessor2()
7878
$this->assertEquals('test', $record['message']);
7979
$this->assertEquals(Logger::INFO, $record['priority']);
8080
}
81+
82+
public function testClear()
83+
{
84+
$handler = new TestHandler();
85+
$logger = new Logger('test', array($handler));
86+
$logger->pushProcessor(new DebugProcessor());
87+
88+
$logger->addInfo('test');
89+
$logger->clear();
90+
91+
$this->assertEmpty($logger->getLogs());
92+
$this->assertSame(0, $logger->countErrors());
93+
}
8194
}

src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ public function collect(Request $request, Response $response, \Exception $except
4444
{
4545
}
4646

47+
/**
48+
* {@inheritdoc}
49+
*/
50+
public function reset()
51+
{
52+
$this->profile->reset();
53+
$this->computed = null;
54+
$this->data = array();
55+
}
56+
4757
/**
4858
* {@inheritdoc}
4959
*/

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"require": {
1919
"php": "^7.1.3",
20-
"twig/twig": "~1.34|~2.4"
20+
"twig/twig": "^1.35|^2.4.4"
2121
},
2222
"require-dev": {
2323
"fig/link-util": "^1.0",

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ CHANGELOG
8181
and `YamlLintCommand` classes have been marked as final
8282
* Added `asset.request_context.base_path` and `asset.request_context.secure` parameters
8383
to provide a default request context in case the stack is empty (similar to `router.request_context.*` parameters)
84+
* Display environment variables managed by `Dotenv` in `AboutCommand`
8485

8586
3.3.0
8687
-----

0 commit comments

Comments
 (0)