This may go against the intended design of the framework in the first
place, but in a typical application such a function would just be a
standard function, not part of any class. There's no doubt that there
are plenty of gaps in the functions that come with PHP, so a problem
like this may well crop up again.
Couldn't the framework introduce a standard way of defining these
utility functions, which could easily be included by Zend_Loader?
I've run into the same problem myself when developing a set of my own
components that work with/extend ZF. Currently I just have a folder
called "functions", at the same level as the "library" folder, which
contains a few PHP files with all my additional functions.
Just a thought.
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.
--
Jack