vinkla/hashids

TypeError: Unsupported operand types: int - string on PHP 8.1

masroore opened this issue · 1 comments

I'm getting the following error:

TypeError: Unsupported operand types: int - string

/path/to/laravel/vendor/hashids/hashids/src/Hashids.php:203
/path/to/laravel/vendor/mtvs/eloquent-hashids/src/HasHashid.php:48
/path/to/laravel/vendor/mtvs/eloquent-hashids/src/HasHashid.php:24
/path/to/laravel/app/Http/Controllers/ItemController.php:13

This is the offending line:

$excess = \mb_strlen($ret) - $this->minHashLength;

Somehow int $minHashLength becomes a string.

FYI, in my config/hashids.php the length parameter is set as an int.

Using PHP 8.1.4 (Laravel 8.83.5)

mtvs/eloquent-hashids#24

Please submit a pull request with a failing test case.