The question is what should be supported. mbstring is not a default extension and function overloading is not the default setting in this extension. If we follow a 80:20 or even a 90:10 rule this is not a ZF bug, just a not supported extension/setting.

But as soon as we raise the required PHP version to 5.2 we should use the binary-cast, so we would be compatible with PHP6.

In the meanwhile there is a workaround. mstring.func_overloaded can be set per directory, but it's not recommended. Maybe it'd be better to use runkit if overloading is really needed, because it can be controlled per request.

nico

Shahar Evron wrote:
Hi all,

I am working on one of the Http_Client bugs, ZF-2098, which describes a
problem the Http_Client has when sending multi-byte encoded (eg. UTF8
Chinese) text in the request body when mbstring is loaded and overloads the strlen() function. This happens because I've been using strlen () to
calculate the body size (in bytes - not in characters).

This works in most cases, but when mbstring overloads strlen with
mb_strlen - what you get is the string length in characters and not in
bytes.

Brian DeShong already proposed a patch fixing the problem, but I've
found that there are several Zend_Http classes that suffer from the same
problem. I'm sure that other ZF classes, as well as users, who need a
transparent way to calculate string length in bytes, irregardless of
loaded extensions or PHP version (no idea what PHP 6 / 5.3 would cause
in this case).

So, is there any component of the framework where you would see a
static ::strByteLength($string) method? I was going to implement one in
Zend_Http_Client - but it's not really Zend_Http_Client specific.

Suggestions welcome ;)

Shahar.


Reply via email to