Skip to content

transChoice method is deprecated in Symfony 4.2 #188

Closed
@michaelcopeland

Description

@michaelcopeland

Hello,

I wanted to add this here to provide heads up/help someone else since I was able to fix this issue (hopefully correctly).

I recently upgraded from sentry-laravel 0.7.0 to 1.0.0-beta3 as per the integration guide. All appeared to work well since updating until visiting a inner blade page that makes use thujohn/twitter's ago method (\Thujohn\Twitter\Facades\Twitter::ago($user->updated_at)). This page was now heavily broken as some HTML tags weren't closed (since the exception was thrown) as well as the updated_at data being missing. It appears the deprecation is being treated as an exception (see references below).

Upon removing "sentry/sentry-laravel": "1.0.0-beta3" from composer.json things work correctly. 0.7.0 also previously worked correctly.

My fix:
Instead of downgrading symfony/translation as per reference 1, I was able to correct this by adding "\Symfony\Component\Translation\Translator::transChoice," to the $dontReport array within app/Exceptions/Handler.php. I'm hoping this won't cause any other funny business within the application.

Full error:
User Deprecated: The "Symfony\Component\Translation\Translator::transChoice()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%count%" parameter.

References:
briannesbitt/Carbon#1548
symfony/symfony#29607

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