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

[FrameworkBundle] Remove fileLinkFormat property from DebugHandlersListener #42235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
null, // Log levels map for enabled error levels
param('debug.error_handler.throw_at'),
param('kernel.debug'),
service('debug.file_link_formatter'),
param('kernel.debug'),
service('monolog.logger.deprecation')->nullOnInvalid(),
])
Expand Down
1 change: 1 addition & 0 deletions 1 src/Symfony/Component/HttpKernel/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
---

* Deprecate `AbstractTestSessionListener::getSession` inject a session in the request instead
* Deprecate the `fileLinkFormat` parameter of `DebugHandlersListener`

5.3
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\HttpKernel\KernelEvents;

Expand All @@ -39,21 +38,25 @@ class DebugHandlersListener implements EventSubscriberInterface
private $levels;
private $throwAt;
private $scream;
private $fileLinkFormat;
private $scope;
private $firstCall = true;
private $hasTerminatedWithException;

/**
* @param callable|null $exceptionHandler A handler that must support \Throwable instances that will be called on Exception
* @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants
* @param int|null $throwAt Thrown errors in a bit field of E_* constants, or null to keep the current value
* @param bool $scream Enables/disables screaming mode, where even silenced errors are logged
* @param string|FileLinkFormatter|null $fileLinkFormat The format for links to source files
* @param bool $scope Enables/disables scoping mode
* @param callable|null $exceptionHandler A handler that must support \Throwable instances that will be called on Exception
* @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants
* @param int|null $throwAt Thrown errors in a bit field of E_* constants, or null to keep the current value
* @param bool $scream Enables/disables screaming mode, where even silenced errors are logged
* @param bool $scope Enables/disables scoping mode
*/
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true, LoggerInterface $deprecationLogger = null)
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, $scope = true, $deprecationLogger = null, $fileLinkFormat = null)
{
if (!\is_bool($scope)) {
trigger_deprecation('symfony/http-kernel', '5.4', 'Passing a $fileLinkFormat is deprecated.');
$scope = $deprecationLogger;
$deprecationLogger = $fileLinkFormat;
}

$handler = set_exception_handler('var_dump');
$this->earlyHandler = \is_array($handler) ? $handler[0] : null;
restore_exception_handler();
Expand All @@ -63,7 +66,6 @@ public function __construct(callable $exceptionHandler = null, LoggerInterface $
$this->levels = $levels ?? \E_ALL;
$this->throwAt = \is_int($throwAt) ? $throwAt : (null === $throwAt ? null : ($throwAt ? \E_ALL : null));
$this->scream = $scream;
$this->fileLinkFormat = $fileLinkFormat;
$this->scope = $scope;
$this->deprecationLogger = $deprecationLogger;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\ConsoleEvents;
Expand All @@ -34,6 +35,8 @@
*/
class DebugHandlersListenerTest extends TestCase
{
use ExpectDeprecationTrait;

public function testConfigure()
{
$logger = $this->createMock(LoggerInterface::class);
Expand Down Expand Up @@ -219,7 +222,7 @@ public function testLevelsAssignedToLoggers(bool $hasLogger, bool $hasDeprecatio
->method('setDefaultLogger')
->withConsecutive(...$expectedCalls);

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

try {
Expand All @@ -236,4 +239,14 @@ public function testLevelsAssignedToLoggers(bool $hasLogger, bool $hasDeprecatio
throw $e;
}
}

/**
* @group legacy
*/
public function testLegacyConstructor()
{
$this->expectDeprecation('Since symfony/http-kernel 5.4: Passing a $fileLinkFormat is deprecated.');

new DebugHandlersListener(null, null, \E_ALL, \E_ALL, true, 'filelinkformat', true, $this->createMock(LoggerInterface::class));
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.