我应该使用多字节重载(mbstring.func_overload)吗? [英] Should I use multi-byte overloading (mbstring.func_overload)?

查看:126
本文介绍了我应该使用多字节重载(mbstring.func_overload)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使我的PHP网站能够识别Unicode.我想知道是否有人对mbstring.func_overload设置有经验,该设置将普通的字符串函数(例如strlen)替换为它们的多字节等效项(mb_strlen). PHP手册页上没有任何评论.

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.

推荐答案

您绝对应该注意的一个问题是使用非mb-aware版本的函数的第三方脚本(也许是库或pear扩展).例如,使用strlen()的库如果重载它可能会导致问题.

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.

同样,此错误报告显示了虚拟主机的mb_overloaded函数已在5.2/5.3 CVS版本中得到纠正.该错误特定于每个目录的配置.

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.

这篇关于我应该使用多字节重载(mbstring.func_overload)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆