ZF-9058: Zend_Filter_StringToLower / Upper throws exception with valid mbstring encoding


Since the 1.10.0, both filters Zend_Filter_StringToUpper and Zend_filter_StringToLower check the $encoding param :

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");

The problem is this test is case sensitive, but mbstring functions aren't. Following code works well in 1.9.7 but 1.10.0 break it :

$filter = new Zend_Filter_StringToUpper();
$filter->setEncoding('utf-8'); // => Exception thrown in 1.10.0 : "The given encoding 'utf-8' is not supported by mbstring"
echo $filter->filter('test'); // => Works well in 1.9.7 : no warning from mb_strtoupper function

I think this behavior is not desired.


Fixed with r20912