tags:

views:

284

answers:

1

I'm in the process of making my PHP site Unicode-aware. I'm wondering if anyone has experience with the mbstring.func_overload setting, which replaces the normal string functions (e.g. strlen) with their multi-byte equivalents (mb_strlen). There aren't any comments on the PHP manual page.

Are there any potential problems that I should be aware of? Any cases where calling the multi-byte version is a bad idea?

I suppose one example would be functions that deal with encryption, since they may expect to deal with strings of bytes, rather than strings of characters.

Also, the manual page includes a note: "It is not recommended to use the function overloading option in the per-directory context, because it's not confirmed yet to be stable enough in a production environment and may lead to undefined behaviour."

Does that mean that it's not stable in a per-directory context, or it's generally not stable? The wording is unclear.

+1  A: 

one issue you should definitely watch for is 3rd party scripts (perhaps a library or pear extension) which uses non mb-aware versions of functions. for example, libraries that use strlen() could cause issues if you overload it.

as well, this bug report shows that the virtual host bleeding of mb_overloaded functions have been corrected in 5.2/5.3 CVS versions. the bug is specific to per-directory configurations.

Owen