Page MenuHomePhorge

D25092.1736695659.diff
No OneTemporary

D25092.1736695659.diff

diff --git a/src/utils/utf8.php b/src/utils/utf8.php
--- a/src/utils/utf8.php
+++ b/src/utils/utf8.php
@@ -289,7 +289,14 @@
*/
function phutil_utf8_strlen($string) {
if (function_exists('utf8_decode')) {
- return strlen(utf8_decode($string));
+ // historically, this was just a call to strlen(utf8_decode())
+ // but, since PHP 8.2 that function is deprecated, so this is
+ // the current equivalent.
+ // TODO: probably we can just adopt mb_strlen($string, 'ISO-8859-1')
+ // but I'm not bold enough to change this so deeply in this phase,
+ // where my goal was just to fix PHP 8.2.
+ // https://we.phorge.it/T15188
+ return strlen(mb_convert_encoding($string, 'ISO-8859-1'));
}
return count(phutil_utf8v($string));
}

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 12, 15:27 (6 d, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1112638
Default Alt Text
D25092.1736695659.diff (761 B)

Event Timeline