Deprecated: Invalid characters passed for attempted conversion… line 355
-
I got this warning on a server running Apache2 and PHP 8.3.
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /…/public/wp-content/plugins/ko-fi-button/class-ko-fi.php on line 355
The fix is below, in the second line:
public static function get_contrast_yiq( $hex ) {
$hex = ltrim( $hex, '#' );
$r = hexdec( substr( $hex, 0, 2 ) );
$g = hexdec( substr( $hex, 2, 2 ) );
$b = hexdec( substr( $hex, 4, 2 ) );
$yiq = ( ( $r * 299 ) + ( $g * 587 ) + ( $b * 114 ) ) / 1000;
return ( $yiq >= 128 ) ? '#323842' : '#fff';
}I’m guessing that it’s been called with the ‘#’ in the $hex value.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.