api-library icon indicating copy to clipboard operation
api-library copied to clipboard

Mautic API not working with Psr/Log v3

Open rebbieboi opened this issue 2 years ago • 5 comments

Declaration of Mautic\Api\Api::setLogger(Psr\Log\LoggerInterface $logger) must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger): void {"userId":27,"exception":"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Declaration of Mautic\Api\Api::setLogger(Psr\Log\LoggerInterface $logger) must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger): void at /vendor/mautic/api-library/lib/Api/Api.php:127)

I fixed this by forcing "psr/log": "~2.0". Note that I'm using Laravel 10 which I think upgraded it to v3.0

I'm also using: "mautic/api-library": "^3.1.0",

rebbieboi avatar Sep 19 '23 14:09 rebbieboi

Can you try updating to the changes in the main branch? It should have been fixed there but not yet released.

escopecz avatar Sep 19 '23 19:09 escopecz

Can you try updating to the changes in the main branch? It should have been fixed there but not yet released.

not too sure how to do that. But I'll just wait for the official release. Do we know when that would be? Thank you!

rebbieboi avatar Sep 20 '23 05:09 rebbieboi

Here is how to checkout a branch with Composer: https://getcomposer.org/doc/articles/versions.md#branches

There is no release date at the moment.

escopecz avatar Sep 20 '23 16:09 escopecz

Had the same error, I managed to solve it by activating the PSR extension in PHP. In my case the PSR extension was not activated by default on my install.

michaelandre0 avatar Dec 06 '23 10:12 michaelandre0

Since I cannot create a PR for a git tag here is a patch for tag 3.1.0 (taken from https://github.com/mautic/api-library/compare/3.1.0...theodorosploumis:api-library:3.1.0.patch)

mautic_api_3.1.0_psr_log_v3.PATCH

theodorosploumis avatar Mar 05 '24 15:03 theodorosploumis