Skip to content

Commit

Permalink
Convert to string
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkla committed Mar 1, 2018
1 parent af94352 commit 5007e6a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Hashids.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function encode(...$numbers): string
$numbersHashInt = 0;

foreach ($numbers as $i => $number) {
$numbersHashInt += $this->math->intval($this->math->mod($number, (string) ($i + 100)));
$numbersHashInt += $this->math->intval($this->math->mod((string) $number, (string) ($i + 100)));
}

$lottery = $ret = $alphabet[$numbersHashInt % strlen($alphabet)];
Expand Down Expand Up @@ -265,7 +265,7 @@ public function decode(string $hash): array
foreach ($hashArray as $subHash) {
$alphabet = $this->shuffle($alphabet, substr($lottery.$this->salt.$alphabet, 0, strlen($alphabet)));
$result = $this->unhash($subHash, $alphabet);
if ($this->math->greaterThan($result, PHP_INT_MAX)) {
if ($this->math->greaterThan($result, (string) PHP_INT_MAX)) {
$ret[] = $this->math->strval($result);
} else {
$ret[] = $this->math->intval($result);
Expand Down

0 comments on commit 5007e6a

Please sign in to comment.