Looks like a subtle bug in that we are throwing an Exception for valid data - 
the check should be made case insensitive. Can you file an issue? I'm sure the 
lead dev would also appreciate it if you note any other classes likewise 
impacted.

Paddy

 Pádraic Brady

http://blog.astrumfutura.com
http://www.survivethedeepend.com
OpenID Europe Foundation Irish Representative





________________________________
From: Lucas CORBEAUX <[email protected]>
To: [email protected]
Sent: Tue, February 2, 2010 8:57:19 AM
Subject: [fw-general] Migration to 1.10.0 and setEncoding exception

Hello there,

As I'm working on migrating my projects into 1.10.0 I found a breaking
feature in Zend_Filter_StringToUpper (and probably in some others
filters / validators working with mbstring functions) in the setEncoding
method.

Here is the problem : 
$encoding = (string) $encoding;
if (!in_array($encoding, mb_list_encodings())) {
    require_once 'Zend/Filter/Exception.php';
    throw new Zend_Filter_Exception("The given encoding '$encoding' is
not supported by mbstring");
}

Now the encoding is checked, that's a great thing. But the following
guide : http://framework.zend.com/manual/1.10/en/migration.110.html
doesn't talk about this feature, which can break some project. Ok,
that's not a real problem, because in case of an incorrect encoding
mbstring functions display a warning.

But there is, in my opinion, a real problem. Mbstring functions are case
insensitives with the encoding param, but the following test :

if (!in_array($encoding, mb_list_encodings()))

Is case sensitive.

So the following code will throw an exception :

$filter = new Zend_Filter_StringToUpper();
$filter->setEncoding('utf-8'); // mb_strtoupper($myString, 'utf-8')
seems to work fine...

I'm not sure if it's a desired behavior or if it's an issue, but, at
least, I think one or two words about it in the migration guide should
be really welcome ;)

Lucas

Reply via email to