bugsnag/bugsnag-laravel

Error with PHP8.1, Laravel 9.x

bretthaddoak opened this issue · 2 comments

Describe the bug

Declaration of Bugsnag\PsrLogger\BugsnagLogger::log(mixed $level, Stringable|string $message, array $context = []): void must be compatible with PsrExt\Log\LoggerInterface::log($level, $message, array $context = [])

Steps to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Environment

  • Linux Distro: Ubuntu Server 22.10
  • Bugsnag version: 2.25
  • PHP version: 8.1
  • Composer version: 2.5.1
  • Laravel version: 9.46.0
  • PSR-LOG: 3.x

Example Repo

  • Happens on fresh Laravel project
Error messages: Declaration of Bugsnag\PsrLogger\BugsnagLogger::log(mixed $level, Stringable|string $message, array $context = []): void must be compatible with PsrExt\Log\LoggerInterface::log($level, $message, array $context = [])

Hi @bretthaddoak.
This looks very similar to a issue raised here: bugsnag/bugsnag-psr-logger#54 with the likely root cause being identified as bugsnag/bugsnag-psr-logger#54 (comment)
Can you confirm if you are using a similar package or have any dependencies that could be using PSR log v1?

bugsnag/bugsnag-psr-logger#54 (comment) has also been suggested as a workaround.

Sorry I didn't catch that, got to be one of the dumbest production issues I've encountered recently. It was the php8.1-psr package being installed that was the culprit. Removing it solved the problem. Thanks @johnkiely1