Replace deprecated seems_utf8() and removed utf8_encode()#4900
Replace deprecated seems_utf8() and removed utf8_encode()#4900GaryJones wants to merge 2 commits intobuddyboss:releasefrom
Conversation
seems_utf8() is deprecated in WordPress 6.9 in favour of wp_is_valid_utf8(). utf8_encode() was removed in PHP 8.2. Replace both with their modern equivalents, with backward-compatible fallbacks for older WordPress/PHP versions.
chetansatasiya
left a comment
There was a problem hiding this comment.
@GaryJones Thanks for the PR and it will be added in our upcoming release.
|
@claude Review the PR |
|
Claude finished @chetansatasiya's task in 1m 48s —— View job PR Review: Replace deprecated seems_utf8() and removed utf8_encode()
OverviewThis PR correctly addresses two real compatibility issues — the WordPress 6.9 deprecation of Issues Found1. Missing
|
Problem
BuddyBoss Platform uses two functions that are deprecated or removed in modern PHP/WordPress:
seems_utf8()— deprecated in WordPress 6.9 in favour ofwp_is_valid_utf8(). Used inBP_Attachment::sanitize_utf8_filename().utf8_encode()— removed in PHP 8.2 (previously deprecated in 8.1). Used inbbp_get_reply_author_display_name()andbbp_get_topic_author_display_name().Sites running WordPress 6.9+ see deprecation notices from
seems_utf8(), and sites on PHP 8.2+ get fatal errors fromutf8_encode().Fix
For
seems_utf8(): Usewp_is_valid_utf8()when available (WordPress 6.9+), falling back toseems_utf8()on older versions.For
utf8_encode(): Usemb_convert_encoding($str, 'UTF-8', 'ISO-8859-1')which is the recommended replacement. Falls back toutf8_encode()only on PHP versions wheremb_convert_encodingis unavailable (effectively PHP < 7.2, which is well past end of life).All replacements include backward-compatible fallbacks so the code works across WordPress and PHP versions.
Files changed
src/bp-core/classes/class-bp-attachment.php—seems_utf8()→wp_is_valid_utf8()src/bp-forums/replies/template.php—utf8_encode()→mb_convert_encoding()src/bp-forums/topics/template.php—utf8_encode()→mb_convert_encoding()Test plan