-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Check data types in default CoreExtension #3609
Comments
I have that with the Would it be against a best practice to allow and handle
That is correct, as PHP's I can provide a PR implementing this small change, maybe also for the other affected string related filters as mentioned in the first post. Returning an empty string in that cases would reflect the current behavior, but in an explicit way: Another and maybe better solution would be a Edit: That nullsafe operator stuff already is another issue 😉: #3260 |
See #3617 |
This PR was merged into the 2.x branch. Discussion ---------- Allow null when Twig expects a string To ease the transition to PHP 8.1, Twig now explicitly accepts `null` in addition to strings in filters that expect strings. Closes #3615 Closes #3557 Closes #3610 Closes #3609 Commits ------- 92bc110 Allow null when Twig expects a string
I am currently upgrading a project for PHP 8.1. I get lot of mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in vendor/twig/twig/src/Extension/CoreExtension.php on line 1098
It's pretty hard to find which template/variable is triggern this. Maybe it makes sense to check the type in the CoreExtension and throw an error?
The text was updated successfully, but these errors were encountered: