Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.

Commit 3c4d656

Browse files
committed
Workaround in case transliterate removed all letters
This bug was hidden previously, as some results kept the separator only (a single dot ".") thus were not empty.
1 parent bc3a070 commit 3c4d656

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Faker/Provider/Internet.php

+10
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ public function userName()
9696
$username = static::transliterate($username);
9797
$username = strtolower(rtrim($username, '.'));
9898

99+
// fallback in case transliterate() doesn't support the language and removed all letters
100+
if ($username === '') {
101+
return $this->word;
102+
}
103+
99104
return $username;
100105
}
101106
/**
@@ -126,6 +131,11 @@ public function domainWord()
126131
$lastName = static::transliterate($lastName);
127132
$lastName = strtolower(rtrim($lastName, '.'));
128133

134+
// fallback in case transliterate() doesn't support the language and removed all letters
135+
if ($lastName === '') {
136+
return $this->word;
137+
}
138+
129139
return $lastName;
130140
}
131141

0 commit comments

Comments
 (0)