From d2335c86b25e0ecd768a083a6012334e12c84819 Mon Sep 17 00:00:00 2001 From: Piotr Likoski Date: Fri, 12 Jul 2019 17:05:27 +0200 Subject: [PATCH] Base32::decode() cannot return boolean values. --- tests/base32_test.aer | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/base32_test.aer b/tests/base32_test.aer index c85aa2e..f79b343 100644 --- a/tests/base32_test.aer +++ b/tests/base32_test.aer @@ -42,10 +42,10 @@ class Base32 { if(!$input) return ''; int $paddingCharCount = substr_count($input, Base32::$map[32]); int[] $allowedValues = {6, 4, 3, 1, 0}; - if(!in_array($paddingCharCount, $allowedValues)) return NULL; + if(!in_array($paddingCharCount, $allowedValues)) return ''; for(int $i = 0; $i < 4; $i++) { if($paddingCharCount == $allowedValues[$i] && substr($input, -($allowedValues[$i])) != str_repeat(Base32::$map[32], $allowedValues[$i])) - return false; + return ''; } $input = str_replace('=','', $input); char[] $aInput = str_split($input); @@ -53,7 +53,7 @@ class Base32 { for($i = 0; $i < sizeof($aInput); $i = $i + 8) { string $x = ''; if(!in_array($input[$i], Base32::$map)) - return false; + return ''; for(int $j = 0; $j < 8; $j++) { if(array_key_exists($input[$i + $j], Base32::$flippedMap)) { $x += str_pad(base_convert(Base32::$flippedMap[$input[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);