diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 594feffa..6207da1e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,8 +45,8 @@ jobs: - name: PHPStan code analysis run: php vendor/bin/phpstan analyze - - name: PHPinsights code analysis - run: php vendor/bin/phpinsights analyse --no-interaction +# - name: PHPinsights code analysis +# run: php vendor/bin/phpinsights analyse --no-interaction # - name: Execute Rector # continue-on-error: true diff --git a/composer.json b/composer.json index 5cf7f5de..d85066e0 100644 --- a/composer.json +++ b/composer.json @@ -27,12 +27,10 @@ "ext-gd" : "*", "ext-exif" : "*", "squizlabs/php_codesniffer" : ">=3.7", - "phpunit/phpunit" : "^10 || ^11 || ^12", + "phpunit/phpunit" : "^10 || ^11 || ^12 || ^13", "phpstan/extension-installer": "^1.4", "phpstan/phpstan": "^2", - "phpstan/phpstan-phpunit": "^2", - "rector/rector": "^2", - "nunomaduro/phpinsights": "^2" + "phpstan/phpstan-phpunit": "^2" }, "config": { "allow-plugins": { diff --git a/src/PelConvert.php b/src/PelConvert.php index 79cb2428..11ef10ea 100644 --- a/src/PelConvert.php +++ b/src/PelConvert.php @@ -106,9 +106,15 @@ public static function longToBytes(int $value, bool $endian): string */ $hex = str_pad(base_convert((string) $value, 10, 16), 8, '0', STR_PAD_LEFT); if ($endian === self::LITTLE_ENDIAN) { - return chr((int) hexdec($hex[6] . $hex[7])) . chr((int) hexdec($hex[4] . $hex[5])) . chr((int) hexdec($hex[2] . $hex[3])) . chr((int) hexdec($hex[0] . $hex[1])); + return chr(((int) hexdec($hex[6] . $hex[7])) & 0xFF) . + chr(((int) hexdec($hex[4] . $hex[5])) & 0xFF) . + chr(((int) hexdec($hex[2] . $hex[3])) & 0xFF) . + chr(((int) hexdec($hex[0] . $hex[1])) & 0xFF); } - return chr((int) hexdec($hex[0] . $hex[1])) . chr((int) hexdec($hex[2] . $hex[3])) . chr((int) hexdec($hex[4] . $hex[5])) . chr((int) hexdec($hex[6] . $hex[7])); + return chr(((int) hexdec($hex[0] . $hex[1])) & 0xFF) . + chr(((int) hexdec($hex[2] . $hex[3])) & 0xFF) . + chr(((int) hexdec($hex[4] . $hex[5])) & 0xFF) . + chr(((int) hexdec($hex[6] . $hex[7])) & 0xFF); } /** diff --git a/src/PelEntryByte.php b/src/PelEntryByte.php index a7ec96b3..b851983a 100644 --- a/src/PelEntryByte.php +++ b/src/PelEntryByte.php @@ -44,6 +44,6 @@ public function __construct(int $tag, int ...$value) */ public function numberToBytes(int $number, bool $order): string { - return chr($number); + return chr($number & 0xFF); } } diff --git a/src/PelJpegMarker.php b/src/PelJpegMarker.php index 28d8e4ab..58168ae8 100644 --- a/src/PelJpegMarker.php +++ b/src/PelJpegMarker.php @@ -461,7 +461,7 @@ public static function isValid(int $marker): bool */ public static function getBytes(int $marker): string { - return chr($marker); + return chr($marker & 0xFF); } /**