Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
10 changes: 8 additions & 2 deletions src/PelConvert.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/PelEntryByte.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
2 changes: 1 addition & 1 deletion src/PelJpegMarker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down