-
-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transChoice method is deprecated in Symfony 4.2 #188
Comments
This sounds like when you when downgraded to Sentry should never interrupt the request, ever. It looks like the Laravel error handler is the culprit here converting the notice to an exception (which is in the end also captured by Sentry). However, I will keep this open so we can investigate and see if we can replicate the behaviour. |
Hey @stayallive, To clarify a bit, I didn't have to downgrade to I've run a I hope this helps and thanks a lot for your time/attention. Please let me know if I can help further. |
+1 same problem. |
I have installed a clean Laravel 5.7 to test this issue and followed the installation instructions: https://docs.sentry.io/platforms/php/laravel/#laravel-5x (made no changes to any config). I tested the following route: Route::get('/', function () {
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), E_USER_DEPRECATED);
return view('welcome');
}); And in that view used (made sure translations package is 4.2.x): {{ now()->diffForHumans() }} And couldn't trigger the deprecation to show up as ErrorException (or breaking the view/app) or being sent to Sentry. The following worked immediately (as expected): Route::get('/', function () {
throw new Exception('Pizza!');
return view('welcome');
}); Hope you can possibly provide some more info or configuration that could trigger this exception. Are you using the log channels? Did you make any changes in the A stack trace of the error could help too so we can possibly see via which path it ended up being re-thrown. |
What is the PHP version you are running on? And do you have a stacktrace for the error? |
try adding a user context to sentry earlier in the request before the trigger_error PHP 7.2.0
|
@jiriko thanks for all the info! I'm getting somewhere with this 👍 |
@jiriko can you upgrade to the latest beta versions and see if it's still there? sentry/sentry-laravel 1.0.0-beta4 (which should install sentry/sentry 2.0.0-beta2) |
it keeps sending the error
to sentry but the application now works fine |
@jiriko yes, that's expected. Sentry is logging exceptions and errors (a deprecation is triggered by 'error_types' => E_ALL & ~E_USER_DEPRECATED, This means send everyting except deprecation notices. Our default is to log |
@stayallive perfect! thank you so much |
@jiriko No problem, going to close this issue since was already fixed. If you are still having issues make sure you are on If you don't want deprecated notices being sent to Sentry read: #188 (comment) |
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
The text was updated successfully, but these errors were encountered: