From 0c7df724deb2cf479fd7421cc1a20166d2424af3 Mon Sep 17 00:00:00 2001 From: Marcel Naeve Date: Sun, 5 May 2024 02:55:42 +0200 Subject: [PATCH] =?UTF-8?q?nutzung=20von=20multibite=20(mb=5F)=20funktione?= =?UTF-8?q?n=20entfernt,=20da=20mittlerweile=20unn=C3=B6tig.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/class.Validate.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/class.Validate.php b/src/class.Validate.php index d83ec63..58a1715 100644 --- a/src/class.Validate.php +++ b/src/class.Validate.php @@ -135,20 +135,20 @@ class Validate "ES" => 24, "SE" => 24, "CH" => 21, "TN" => 24, "TR" => 26, "AE" => 23, "GB" => 22, "VG" => 24 ]; - $iban = mb_ereg_replace("/(\s|\-)/", "", $iban); // sanitize for validation (remove spaces) - $country = mb_strtoupper(mb_substr($iban, 0, 2)); + $iban = preg_replace("/(\s|\-)/", "", $iban); // sanitize for validation (remove spaces) + $country = strtoupper(substr($iban, 0, 2)); // we know the country the IBAN belongs to? if(isset($country_length[$country])) { // The IBAN matches in length and basic structure? $matches = null; - if(mb_ereg_match('/^([A-Za-z]{2})(\d{2})([A-Za-z0-9]{' . ($country_length[$country]-4) . '})$/', $iban, $matches)) { + if(preg_match('/^([A-Za-z]{2})(\d{2})([A-Za-z0-9]{' . ($country_length[$country]-4) . '})$/', $iban, $matches)) { $checkNum = $matches[1]; $bban = strtoupper($matches[2]); // Replace letters with digits (a or A => 11, b or B => 12,..) - $checkString = mb_ereg_replace_callback('/[A-Z]/', function ($matches) { + $checkString = preg_replace_callback('/[A-Z]/', function ($matches) { return base_convert($matches[0], 36, 10); }, $bban . $country . '00'); @@ -188,7 +188,7 @@ class Validate $swift = trim($swift); // sanitize swift/bic if($iban !== null) { - $iban = mb_ereg_replace("/(\s|\-)/", "", $iban); // sanitize iban + $iban = preg_replace("/(\s|\-)/", "", $iban); // sanitize iban $api_result = file_get_contents("https://api.swiftrefdata.com/v1/ibans/$iban/bic.xml"); $api_result_array = json_decode(json_encode((array) simplexml_load_string($api_result)),1); @@ -199,7 +199,7 @@ class Validate } - return mb_ereg_match("^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$", $swift); + return preg_match("^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$", $swift); } } \ No newline at end of file