nette / utils

🛠 Lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.
https://doc.nette.org/utils
Other
1.98k stars 147 forks source link

Strings::toAscii inconsistent "fallback" behavior #234

Closed cniry closed 4 years ago

cniry commented 4 years ago

Version: 3.1

Bug Description

Strings::toAscii inconsistent "fallback" behavior causes it to silently break my data under certain circumstances.

Strings::toAscii si trying to use a) Transliterator b) iconv c) it try to "at least remove non-ascii chars", which is very ugly fallback

Problematic lines: https://github.com/nette/utils/blob/v3.1/src/Utils/Strings.php#L191

Steps To Reproduce

Run it with missing Transliterator and iconv.

Expected Behavior

It shoud throw notice/exception because it is not able to work correctly. Not do it in the mode "eat my data".

Possible Solution

It shoud throw notice/exception because it is not able to work correctly. Not do it in the mode "eat my data".

dg commented 4 years ago

Fixed in 3.2 35fa4152629406c3e61e96a17c95f54e874cf517