Skip to content

Commit ade4b89

Browse files
committed
fix: Replaced CEP length check
There was a bug where CEP lenght wouldn't be 8 if the cep starts with a leading 0
1 parent 89290c8 commit ade4b89

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Scripts/CepAberto.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static function fromCep(int|string $cep, string $token = null): array
1717
{
1818
$cep = preg_replace('/[^0-9]/', '', $cep); //Remove everything but numbers
1919

20-
if(Utils::countNumber($cep) != 8)
20+
if(strlen($cep) != 8)
2121
{
2222
return ["statusText" => "invalid"];
2323
}

src/Scripts/ViaCep.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ViaCep
1212
public static function fromCep(int|string $cep): array
1313
{
1414
$cep = preg_replace('/[^0-9]/', '', $cep); //Remove everything but numbers
15-
if(Utils::countNumber($cep) != 8)
15+
if(strlen($cep) != 8)
1616
{
1717
return ["statusText" => "invalid"];
1818
}

0 commit comments

Comments
 (0)