diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aed4718..aaf8e27 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] os: [ubuntu-latest] runs-on: ${{ matrix.os }} diff --git a/src/Util.php b/src/Util.php index b4220e9..0c4cf31 100644 --- a/src/Util.php +++ b/src/Util.php @@ -10,7 +10,9 @@ function hashCode(string $s): int } for ($i = 0; $i < strlen($s); $i++) { $chr = ord($s[$i]); - $hash = (int) (($hash << 5) - $hash + $chr); + // Use bitwise operations to ensure we stay within 32-bit signed integer range + // This prevents float conversion and maintains compatibility with PHP 8.5+ + $hash = ((($hash << 5) - $hash) + $chr) & 0x7FFFFFFF; } return $hash; }