Skip to content

Commit 725c6cc

Browse files
committed
Utility: Fix issues reported by CI workflow
1 parent 22a3f79 commit 725c6cc

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Toolkit/Utility/Str.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,12 @@ public static function decodeBase32(string $string, bool $strict = false): strin
511511
{
512512
$string = self::upper(rtrim($string, '='));
513513

514+
// Handle different `str_split('')` behaviour between PHP 8.2+ and
515+
// earlier versions
516+
if ($string === '') {
517+
return '';
518+
}
519+
514520
$bytes = '';
515521
$currentByte = 0;
516522
$currentBits = 0;

tests/unit/Toolkit/Utility/StrTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,9 @@ public function testDecodeBase32(?string $expected, string $string, bool $strict
886886
$this->assertSame($expected, Str::decodeBase32($string, $strict));
887887
}
888888

889+
/**
890+
* @return array<array{string|null,string,2?:bool}>
891+
*/
889892
public function decodeBase32provider(): array
890893
{
891894
return [

0 commit comments

Comments
 (0)