Issues

ZF-11551: Zend_Filter_StringTrim does not work correctly with input which ends with a unicode char like "à"

Description

Zend_Filter_StringTrim will corrupt the last unicode character whose non utf-8 interpretation ends with a whitespace. For example the non utf-8 interpretation of "à" is "Ã "

The code is simple


$oFilter = new Zend_Filter_StringTrim();

var_dump(
    $oFilter->filter('aàa'),
    $oFilter->filter('àaa'),
    $oFilter->filter('aaa'),
    $oFilter->filter('àaà'),
    $oFilter->filter('ààà'),
    $oFilter->filter('à'),
    $oFilter->filter('ò'),
    $oFilter->filter('ù'),
    $oFilter->filter('ì'),
    $oFilter->filter('д'),
    $oFilter->filter('û')
);

will output:
string(4) "aàa"
string(4) "àaa"
string(3) "aaa"
string(4) "àa�"
string(5) "àà�"
string(1) "�"
string(2) "ò"
string(2) "ù"
string(2) "ì"
string(2) "д"
string(2) "û"

non utf-8 output:
string(4) "aà a"
string(4) "Ã aa"
string(3) "aaa"
string(4) "Ã aÃ"
string(5) "Ã Ã Ã"
string(1) "Ã"
string(2) "ò"
string(2) "ù"
string(2) "ì"
string(2) "д"
string(2) "û"

Comments

Duplicates of ZF-11533.

This issue duplicates ZF-10891

This issue has been fixed with GH-107