Skip to content

Commit b7f1262

Browse files
committed
Strings::toAscii - triggers E_USER_NOTICE when ext-intl is not present
1 parent 10e8d62 commit b7f1262

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Utils/Strings.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,13 @@ public static function toAscii(string $s): string
145145
{
146146
$iconv = defined('ICONV_IMPL') ? trim(ICONV_IMPL, '"\'') : null;
147147
static $transliterator = null;
148-
if ($transliterator === null && class_exists('Transliterator', false)) {
149-
$transliterator = \Transliterator::create('Any-Latin; Latin-ASCII');
148+
if ($transliterator === null) {
149+
if (class_exists('Transliterator', false)) {
150+
$transliterator = \Transliterator::create('Any-Latin; Latin-ASCII');
151+
} else {
152+
trigger_error(__METHOD__ . "(): it is recommended to enable PHP extensions 'intl'.", E_USER_NOTICE);
153+
$transliterator = false;
154+
}
150155
}
151156

152157
// remove control characters and check UTF-8 validity

0 commit comments

Comments
 (0)