Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d3f9da0

Browse filesBrowse files
committed
[HttpKernel] Removed dead code DebugHandlersListener
1 parent 46b2be9 commit d3f9da0
Copy full SHA for d3f9da0

File tree

3 files changed

+33
-21
lines changed
Filter options

3 files changed

+33
-21
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.php
+26-10Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,34 @@
1717
return static function (ContainerConfigurator $container) {
1818
$container->parameters()->set('debug.error_handler.throw_at', -1);
1919

20+
// BC layer between 5.4 and 6.0. Could be remove when dropping support for http kernel 5.x
21+
$constructorParameters = (new \ReflectionMethod(DebugHandlersListener::class, '__construct'))->getParameters();
22+
if (\array_key_exists(5, $constructorParameters) && 'fileLinkFormat' === $constructorParameters[5]->getName()) {
23+
$debugHandlersListenerArgs = [
24+
null, // Exception handler
25+
service('monolog.logger.php')->nullOnInvalid(),
26+
null, // Log levels map for enabled error levels
27+
param('debug.error_handler.throw_at'),
28+
param('kernel.debug'),
29+
service('debug.file_link_formatter'),
30+
param('kernel.debug'),
31+
service('monolog.logger.deprecation')->nullOnInvalid(),
32+
];
33+
} else {
34+
$debugHandlersListenerArgs = [
35+
null, // Exception handler
36+
service('monolog.logger.php')->nullOnInvalid(),
37+
null, // Log levels map for enabled error levels
38+
param('debug.error_handler.throw_at'),
39+
param('kernel.debug'),
40+
param('kernel.debug'),
41+
service('monolog.logger.deprecation')->nullOnInvalid(),
42+
];
43+
}
44+
2045
$container->services()
2146
->set('debug.debug_handlers_listener', DebugHandlersListener::class)
22-
->args([
23-
null, // Exception handler
24-
service('monolog.logger.php')->nullOnInvalid(),
25-
null, // Log levels map for enabled error levels
26-
param('debug.error_handler.throw_at'),
27-
param('kernel.debug'),
28-
service('debug.file_link_formatter'),
29-
param('kernel.debug'),
30-
service('monolog.logger.deprecation')->nullOnInvalid(),
31-
])
47+
->args($debugHandlersListenerArgs)
3248
->tag('kernel.event_subscriber')
3349
->tag('monolog.logger', ['channel' => 'php'])
3450

‎src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php
+6-10Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\Console\Output\ConsoleOutputInterface;
1818
use Symfony\Component\ErrorHandler\ErrorHandler;
1919
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
20-
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
2120
use Symfony\Component\HttpKernel\Event\KernelEvent;
2221
use Symfony\Component\HttpKernel\KernelEvents;
2322

@@ -39,20 +38,18 @@ class DebugHandlersListener implements EventSubscriberInterface
3938
private $levels;
4039
private $throwAt;
4140
private $scream;
42-
private $fileLinkFormat;
4341
private $scope;
4442
private $firstCall = true;
4543
private $hasTerminatedWithException;
4644

4745
/**
48-
* @param callable|null $exceptionHandler A handler that must support \Throwable instances that will be called on Exception
49-
* @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants
50-
* @param int|null $throwAt Thrown errors in a bit field of E_* constants, or null to keep the current value
51-
* @param bool $scream Enables/disables screaming mode, where even silenced errors are logged
52-
* @param string|FileLinkFormatter|null $fileLinkFormat The format for links to source files
53-
* @param bool $scope Enables/disables scoping mode
46+
* @param callable|null $exceptionHandler A handler that must support \Throwable instances that will be called on Exception
47+
* @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants
48+
* @param int|null $throwAt Thrown errors in a bit field of E_* constants, or null to keep the current value
49+
* @param bool $scream Enables/disables screaming mode, where even silenced errors are logged
50+
* @param bool $scope Enables/disables scoping mode
5451
*/
55-
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, string|FileLinkFormatter $fileLinkFormat = null, bool $scope = true, LoggerInterface $deprecationLogger = null)
52+
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, bool $scope = true, LoggerInterface $deprecationLogger = null)
5653
{
5754
$handler = set_exception_handler('var_dump');
5855
$this->earlyHandler = \is_array($handler) ? $handler[0] : null;
@@ -63,7 +60,6 @@ public function __construct(callable $exceptionHandler = null, LoggerInterface $
6360
$this->levels = $levels ?? \E_ALL;
6461
$this->throwAt = \is_int($throwAt) ? $throwAt : (null === $throwAt ? null : ($throwAt ? \E_ALL : null));
6562
$this->scream = $scream;
66-
$this->fileLinkFormat = $fileLinkFormat;
6763
$this->scope = $scope;
6864
$this->deprecationLogger = $deprecationLogger;
6965
}

‎src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function testLevelsAssignedToLoggers(bool $hasLogger, bool $hasDeprecatio
219219
->method('setDefaultLogger')
220220
->withConsecutive(...$expectedCalls);
221221

222-
$sut = new DebugHandlersListener(null, $logger, $levels, null, true, null, true, $deprecationLogger);
222+
$sut = new DebugHandlersListener(null, $logger, $levels, null, true, true, $deprecationLogger);
223223
$prevHander = set_exception_handler([$handler, 'handleError']);
224224

225225
try {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.