Skip to content

Commit 0f815ad

Browse files
committed
Strings::toAscii - triggers E_USER_NOTICE when ext-intl is not present
1 parent 02e165c commit 0f815ad

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/Utils/Strings.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,13 @@ public static function normalizeNewLines(string $s): string
138138
public static function toAscii(string $s): string
139139
{
140140
static $transliterator = null;
141-
if ($transliterator === null && class_exists('Transliterator', false)) {
142-
$transliterator = \Transliterator::create('Any-Latin; Latin-ASCII');
141+
if ($transliterator === null) {
142+
if (class_exists('Transliterator', false)) {
143+
$transliterator = \Transliterator::create('Any-Latin; Latin-ASCII');
144+
} else {
145+
trigger_error(__METHOD__ . "(): it is recommended to enable PHP extensions 'intl'.", E_USER_NOTICE);
146+
$transliterator = false;
147+
}
143148
}
144149

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

0 commit comments

Comments
 (0)