I am trying to migrate php website from version 7 to 8. There is MB_OVERLOAD_STRING used, which is removed in PHP 8. What should I do to migrate it? Just replace all strpos, and other functions to mb_strpos or something else?
Asked
Active
Viewed 797 times
0
-
https://core.trac.wordpress.org/ticket/51399 – stefan_aus_hannover Sep 02 '21 at 16:32
-
1Pretty much, yeah. Though you should make sure that using the `mb_` variant of the function is warranted in each case. AFAIK overloading was removed because it was heavy-handed and interfered with code that deals with binary strings. That said, if the error is coming out of an application or library you should look at updating that rather than modifying it. – Sammitch Sep 02 '21 at 16:35
-
@Sammitch Thanks. Do you mean I need to test every occurrence of normal string function strpos, etc. that it works fine with replacement with mb_ version or keep original strpos if it does not work properly with mb_strpos? – Zlelik Sep 02 '21 at 19:35
-
1Because of what the overloading did, they should all work equivalently. However, you should review and evaluate each usage as not all uses of non-`mb_*()` string functions are for human-readable strings. – Sammitch Sep 02 '21 at 19:40