ZF-9833: Zend_Filter_StripTags is not downwardly compatible

Description

Zend_Filter_StripTags changed it behavior

from: public function __construct($tagsAllowed = null, $attributesAllowed = null, $commentsAllowed = false) { $this->setTagsAllowed($tagsAllowed); $ this->setAttributesAllowed($attributesAllowed);
$this->setCommentsAllowed($commentsAllowed); }

to: public function __construct($options = null) { if ($options instanceof Zend_Config) { $options = $options->toArray(); } else if (!is_array($options)) { $options = func_get_args(); $temp['allowTags'] = array_shift($options); if (!empty($options)) { $temp['allowAttribs'] = array_shift($options); }

        if (!empty($options)) {
            $temp['allowComments'] = array_shift($options);
        }

        $options = $temp;
    }

    if (array_key_exists('allowTags', $options)) {
        $this->setTagsAllowed($options['allowTags']);
    }

    if (array_key_exists('allowAttribs', $options)) {
        $this->setAttributesAllowed($options['allowAttribs']);
    }

    if (array_key_exists('allowComments', $options)) {
        $this->setCommentsAllowed($options['allowComments']);
    }
}

The filter is not downwardly compatible to the old filter this "} else if (!is_array($options)) {" will not handle the old style implementation

e.g. new Zend_Filter_StripTags(array("a","b","hr"),array(),true)

Will always filter all tags!!!!

Comments

Implemented with r22170