cabrerahector / wordpress-popular-posts

WordPress Popular Posts - A highly customizable WordPress widget that displays your most popular posts.
https://wordpress.org/plugins/wordpress-popular-posts/
GNU General Public License v2.0
280 stars 82 forks source link

PHP Deprecated: ctype_digit(): Argument of type null will be interpreted as string #371

Closed cabrerahector closed 10 months ago

cabrerahector commented 10 months ago

From PHP docs:

Warning

As of PHP 8.1.0, passing a non-string argument is deprecated. In the future, the argument will be interpreted as a string instead of an ASCII codepoint. Depending on the intended behavior, the argument should either be cast to string or an explicit call to chr() should be made.

This warning is being triggered by this line from Image.php:

if ( ! ctype_digit($quality) ) {
    ...
}

One potential solution would be to cast $quality as string, like so:

if ( ! ctype_digit((string) $quality) ) {
    ...
}