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

[MonologBridge] PHP Fatal error in \Monolog\Handler\ConsoleHandler using PHP 8.1+ #51768

Copy link
Copy link
Closed as not planned
@g-scalvini

Description

@g-scalvini
Issue body actions

Symfony version(s) affected

5.4.28

Description

On PHP 8.1 & 8.2, when using symfony/symfony v5.4.28 & symfony/monolog-bundle v3.8.0, execute cache clear will throw a PHP Fatal error:

php bin/console cache:clear --env prod
PHP Fatal error: Declaration of Symfony\Bridge\Monolog\Handler\ConsoleHandler::handle(array $record): bool must be compatible with Monolog\Handler\AbstractProcessingHandler::handle(Monolog\LogRecord $record): bool in OMISS/vendor/symfony/symfony/src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php on line 86

This happens because symfony/symfony have a a dev-dependency on "monolog/monolog": "^1.25.1|^2" and symfony/monolog-bundle have a dependency on "monolog/monolog": "^1.22 || ^2.0 || ^3.0". So when executing composer update, it will use monolog/monolog version 3.4.0.

How to reproduce

Create a project using symfony/symfony and symfony/monolog-bundle on PHP 8.1 or PHP 8.2 and execute command:
php bin/console cache:clear

Possible Solution

Execute a backport to Symfony 5.4 for Monolog 3 support, currently available in Symfony 6.1 (PR #46153)

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

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