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

Avoid deprecation notice when using utf8_decode #299

Closed KminekMatej closed 1 year ago

KminekMatej commented 1 year ago

PHP 8.2 throws deprecation notice on utf8_encode and utf8_decode functions. Strings::length used utf8_decode to determine correct length of string - using mb_strlen, or natively using utf8_decode. I refactored this function to use mbstring or iconv extensions to determine correct length.

User can no longer run Strings::length() function without at least one of these extensions, however since they are super common extensions I dont see this as s problem nowadays

dg commented 1 year ago

I did it a little bit differently.

KminekMatej commented 1 year ago

Even better