diff --git a/src/Symfony/Component/String/AbstractUnicodeString.php b/src/Symfony/Component/String/AbstractUnicodeString.php index 9beafe57ebc2..2d29ce91371a 100644 --- a/src/Symfony/Component/String/AbstractUnicodeString.php +++ b/src/Symfony/Component/String/AbstractUnicodeString.php @@ -142,8 +142,10 @@ public function ascii(array $rules = []): self } elseif (ICONV_IMPL === 'glibc') { $s = iconv('UTF-8', 'ASCII//TRANSLIT', $s); } else { - $s = preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) { - $c = iconv('UTF-8', 'ASCII//IGNORE//TRANSLIT', $c[0]); + $s = @preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) { + if ('' === $c = (string) iconv('UTF-8', 'ASCII//IGNORE//TRANSLIT', $c[0])) { + throw new \LogicException(sprintf('"%s" requires a translit-able iconv implementation, try installing "gnu-libiconv" if you\'re using Alpine Linux.', static::class)); + } return 1 < \strlen($c) ? ltrim($c, '\'`"^~') : (\strlen($c) ? $c : '?'); }, $s); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy