Skip to content

Magento 2.4.5 monolog/monolog compatibility. #137

@sergiuec

Description

@sergiuec

The Magento Framework version ^103.0.5 on Magento >=2.4.5 requires monolog/monolog version >=2.7

"name": "magento/framework"
"version": "103.0.5"
...
"require": { "monolog/monolog": "^2.7"

In this version the signature of the method \Monolog\Logger::addRecord has been changed and is not compatible anymore with the class \Gigya\GigyaIM\Logger\Logger which extends the class \Monolog\Logger and overrides that method.
This is why when bin/magento setup:upgrade is run the following warning is thrown:

Warning: Declaration of Gigya\GigyaIM\Logger\Logger::addRecord(int $level, string $message, array $context = Array): bool should be compatible with Monolog\Logger::addRecord(int $level, string $message, array $context = Array, ?Monolog\DateTimeImmutable $datetime = NULL): bool in /var/www/html/vendor/gigya/magento2-im/Logger/Logger.php on line 43

Tested in:
Magento Commerce 2.4.5
Magento Framework version: 103.0.5
PHP ^7.4

And it become worse on Magento Commerce 2.4.5-p2 with Magento framework 103.0.5-p2 on PHP ^8.1 because now a fatal error is thrown.

PHP Fatal error: Declaration of Gigya\GigyaIM\Logger\Logger::addRecord(int $level, string $message, array $context = []): bool must be compatible with Monolog\Logger::addRecord(int $level, string $message, array $context = [], ?Monolog\DateTimeImmutable $datetime = null): bool in /var/www/html/vendor/gigya/magento2-im/Logger/Logger.php on line 43

We are using the version 6.0.0 of the module.

Could you please check.
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions