We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

Commit 5b598e20 authored by Rik ter Beek's avatar Rik ter Beek

#146 fallback if bcmod is not installed

parent cea55f4b
...@@ -86,11 +86,26 @@ class SepaValidator extends AbstractValidator ...@@ -86,11 +86,26 @@ class SepaValidator extends AbstractValidator
$newString .= $movedCharArray[$key]; $newString .= $movedCharArray[$key];
} }
if (bcmod($newString, '97') == 1) { if (function_exists("bcmod")) {
return true; return bcmod($newString, '97') == 1;
} else {
return false;
} }
/**
* if server does not support bcmoc then do this manually:
* http://au2.php.net/manual/en/function.bcmod.php#38474
*/
$x = $newString;
$y = "97";
$take = 5;
$mod = "";
do {
$a = (int)$mod . substr($x, 0, $take);
$x = substr($x, $take);
$mod = $a % $y;
} while (strlen($x));
return (int)$mod == 1;
} else { } else {
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment