ZF-2531: Filter stripping all repeated spaces


A filter stripping all repeated spaces would be useful. Html for example ignores all repeated spaces an just the first is shown.

Such a filter could look like that:


require_once 'Zend/Filter/Interface.php';

class Zend_Filter_StripRepeatedSpaces implements Zend_Filter_Interface

    public function filter($value)

        return preg_replace('/ +/', ' ', $value);




I think a filter called "Zend_Filter_StripSpaces" will be much more senseful. In the constructor you can set whether all spaces or just the repeated ones will be removed.

I will make a proposal in the next days.

I just commited the proposal:…

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Closing as needs-proposal.

Currently under recommendation. See… for details

Correct fix version as it has been deleted unintentionally by another user