diff --git a/src/Ulid.php b/src/Ulid.php index de3ac4e..d2c52ca 100644 --- a/src/Ulid.php +++ b/src/Ulid.php @@ -134,7 +134,7 @@ private function decodeTime(string $time): int $carry = 0; foreach ($timeChars as $index => $char) { - if (($encodingIndex = strrpos(static::ENCODING_CHARS, $char)) === false) { + if (($encodingIndex = strripos(static::ENCODING_CHARS, $char)) === false) { throw new InvalidUlidStringException('Invalid ULID character: ' . $char); } diff --git a/tests/UlidTest.php b/tests/UlidTest.php index 231814c..c636afd 100644 --- a/tests/UlidTest.php +++ b/tests/UlidTest.php @@ -88,5 +88,6 @@ public function testCreatesFromStringWithTrailingNewLine(): void public function testConvertsToTimestamp(): void { $this->assertEquals(1561622862, Ulid::fromString('0001EH8YAEP8CXP4AMWCHHDBHJ')->toTimestamp()); + $this->assertEquals(1561622862, Ulid::fromString('0001eh8yaep8cxp4amwchhdbhj', true)->toTimestamp()); } }