Skip to content
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

PHP 8.2: strwidth() & Colors::pad()/decolorize() should always work with a string #163

Merged
merged 3 commits into from
Sep 29, 2023

Conversation

slaFFik
Copy link
Contributor

@slaFFik slaFFik commented Sep 24, 2023

Fix #162

@slaFFik slaFFik requested a review from a team as a code owner September 24, 2023 10:09
@slaFFik slaFFik changed the title strwidth() should always work with a string strwidth() & Colors::pad() should always work with a string Sep 24, 2023
@slaFFik slaFFik changed the title strwidth() & Colors::pad() should always work with a string PHP 8.2: strwidth() & Colors::pad() should always work with a string Sep 24, 2023
@slaFFik slaFFik changed the title PHP 8.2: strwidth() & Colors::pad() should always work with a string PHP 8.2: strwidth() & Colors::pad()/decolorize() should always work with a string Sep 24, 2023
@swissspidy
Copy link
Member

Only had a quick glance, but can‘t we fix the calling code instead?

@slaFFik
Copy link
Contributor Author

slaFFik commented Sep 29, 2023

I think we can, but it's like a dozen places all over the place :)
Also, those methods are public static, so can (and are) be used by someone else - and the fix of the calling code won't do anything for them.

So I do believe these methods should be adjusted (perhaps together with the calling code as well).

@danielbachhuber danielbachhuber added this to the 0.11.21 milestone Sep 29, 2023
Copy link
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @slaFFik !

I think this is fine to add. A lot of this code is already pretty dodgy, so casting to string isn't really hurting the code quality.

@danielbachhuber danielbachhuber merged commit b3457a8 into wp-cli:master Sep 29, 2023
32 checks passed
@slaFFik slaFFik deleted the patch-1 branch September 29, 2023 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"PHP Deprecated" notices on PHP 8.2: grapheme_strlen, preg_match_all, strlen, str_pad
3 participants