-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Console] Handle calls to mb_ functions with non string arguments #40272
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
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
Please also have a look at the CS errors fabbot reported. |
efdc0f9
to
d0938cf
Compare
Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I should've been more precise. You don't need to fix fabbot errors you haven't caused. In this case, the short tags were a false positive. Can you restore them?
src/Symfony/Component/Mime/Test/Constraint/EmailHtmlBodyContains.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Mime/Test/Constraint/EmailTextBodyContains.php
Outdated
Show resolved
Hide resolved
1c0f6b8
to
250ef7d
Compare
No worry (that's why I made it in a separate commit :) ) |
src/Symfony/Component/Mime/Test/Constraint/EmailHtmlBodyContains.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Mime/Test/Constraint/EmailTextBodyContains.php
Outdated
Show resolved
Hide resolved
3830c75
to
4670282
Compare
8459b70
to
274f7ac
Compare
src/Symfony/Component/ErrorHandler/Resources/views/exception.html.php
Outdated
Show resolved
Hide resolved
In PHP8, a number of functions who were accepting null arguments will only accept string ones. In the polyfill, mb_* functions are declared with a trict type checking of "string". Therefore, we deprecate the use of non string arguments, so that it won't break when either using the polyfill, or future php8 versions.
274f7ac
to
ac45be2
Compare
Thank you @Yopai. |
In PHP8.1, a number of functions who were accepting null arguments will only accept
string ones.
(see https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg)
In the polyfill, mb_* functions are already declared with a strict type checking of "string".
Therefore, it is necessary to get rid of the use of non string arguments when calling mb_* functions,
so that it won't break when either using the polyfill,or future php8 versions.
In every call where the argument may not be a string, this commit enforces the string type of the argument (with transtyping)
--- For reviewers
I generally don't like transtyping, but found it was the more "secure" way (on a non-BC point of view) here.
Specially in Console/Helper/Table.php, where $cell can be an object (there are 2 "$cell instanceof ... tests)
However, where the argument can already be either null or string (and not anything else), there may a beter approach ?
It's the first time I send a PR on symfony, so don't hesitate pointing me to thinks I've forgotten to done.