In lots of places we are making the assumption that strlen() will always return the size in bytes of a variable/string.
And that works in 99% of sites.
But it's possible to have that default behavior altered with mbstring.func_overload, leading to unpredictable results here and there (really hard to reproduce, debug).
So this is a proposal about to consider adding a function/method, let's call it strbytes() for now (more below), basically doing:
And start applying it to all the places where we are, blindly, using strlen() to calculate in bytes. This basic/incomplete grep reveals a number of them grep -r size.*strlen *
I can imagine it implemented as:
1) a new parameter to existing core_text::strlen() function
2) a brand new core_text::strbytes() function.
My vote goes to 2).