Skip to content

[String] throw when Alpine is used and translit fails #37514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2020

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 5.0
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #37213
License MIT
Doc PR -

@nicolas-grekas nicolas-grekas force-pushed the string-iconv-translit branch from 8ffd037 to 98f5d50 Compare July 7, 2020 17:07
@nicolas-grekas nicolas-grekas merged commit f70bcf6 into symfony:5.0 Jul 8, 2020
@nicolas-grekas nicolas-grekas deleted the string-iconv-translit branch July 8, 2020 08:08
@@ -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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why silencing the whole preg_replace_callback call ? shouldn't we silence the iconv call only ?

Copy link
Member Author

@nicolas-grekas nicolas-grekas Jul 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes toggling the error reporting mode only once while doing it in the callback toggles once per match.

This was referenced Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants