Replacement for mb_strimwidth() which is part of php-mbstring package

One of blogs in my WordPress network is using some old, free theme that was using mb_strimwidth() function. This function is part of php-mbstring package which turned out to be disabled by default in my hosting configuration for PHP 7.2 (it is enabled by default for PHP 5.6).

After enabling PHP 7.2 in my hosting configuration it turned out one of my blogs stopped showing content (showing those damn two small smilies instead). After enabling wp_debug mode it turned out that theme was using mb_strimwidth() that was part of disabled php-mbstring package.

The mb_strlen is not part of that package, seems to be part of core PHP and can be used as a workaround.

Read More “Replacement for mb_strimwidth() which is part of php-mbstring package”