vinkla / laravel-hashids

A Hashids bridge for Laravel
MIT License
2k stars 173 forks source link

Exception on converting int to hashid #146

Closed genericmilk closed 3 years ago

genericmilk commented 3 years ago

Hi folkes,

Came across an exception using PHP 8.0.3 and Laravel 8.36.0.

When converting an (int) to a Hashid using Hashids::encode($l->id); (Where $l->id is a number eg. 12345) an exception is reliably thrown:

Unsupported operand types: int - string

This occurs at: vendor/hashids/hashids/src/Hashids.php:203

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

This does not occur on previous versions of PHP 7.4 etc. Tested using dev-master to ensure most up-to-date changes to the codebase are loaded

genericmilk commented 3 years ago

Silly me, just realised this is the wrong package and the file in question pertains to vinkla/hashids 😵 My apologies!