From 2444103ad20ac1d8530dadc66849440fb3988516 Mon Sep 17 00:00:00 2001 From: gertdepagter Date: Wed, 25 Sep 2024 16:58:24 +0200 Subject: [PATCH] Give the correct deprecations for PHP 8.1+ This isn't just for integers that are outside the integer range of -128, 255. https://3v4l.org/PgZ6c --- src/Ctype/Ctype.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Ctype/Ctype.php b/src/Ctype/Ctype.php index ba75a2c95..448d639ff 100644 --- a/src/Ctype/Ctype.php +++ b/src/Ctype/Ctype.php @@ -211,6 +211,10 @@ public static function ctype_xdigit($text) */ private static function convert_int_to_char_for_ctype($int, $function) { + if (\PHP_VERSION_ID >= 80100 && !\is_string($int)) { + @trigger_error($function.'(): Argument of type '.get_debug_type($int).' will be interpreted as string in the future', \E_USER_DEPRECATED); + } + if (!\is_int($int)) { return $int; } @@ -219,10 +223,6 @@ private static function convert_int_to_char_for_ctype($int, $function) return (string) $int; } - if (\PHP_VERSION_ID >= 80100) { - @trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED); - } - if ($int < 0) { $int += 256; }