Symfony 5.3 deprecated getUsername and introduced getUserIdentifier to replace it. Symfony 6.0 has subsequently removed getUsername, leaving only getUserIdentifier. This causes a crash as we're calling a method that may not exist (older code bases may still implement getUsername in addition to getUserIdentifier)
I've added a Maze Runner test for our user detection logic on Symfony 4 and 6. This covers both the getUsername branch, as well as the getUserIdentifier branch
I'll add the same test setup for Symfony 2 & 5 separately, to avoid making this PR too huge
Goal
We automatically detect the logged in user's ID, which currently uses
getUsername
to fetch an identifier:https://github.com/bugsnag/bugsnag-symfony/blob/d094e0e247bfedcd8877f4a864105ec8cede26b8/DependencyInjection/ClientFactory.php#L391-L393
Symfony 5.3 deprecated
getUsername
and introducedgetUserIdentifier
to replace it. Symfony 6.0 has subsequently removedgetUsername
, leaving onlygetUserIdentifier
. This causes a crash as we're calling a method that may not exist (older code bases may still implementgetUsername
in addition togetUserIdentifier
)See https://github.com/bugsnag/bugsnag-symfony/issues/141
Testing
I've added a Maze Runner test for our user detection logic on Symfony 4 and 6. This covers both the
getUsername
branch, as well as thegetUserIdentifier
branchI'll add the same test setup for Symfony 2 & 5 separately, to avoid making this PR too huge