Issues

ZF-9833: Zend_Filter_StripTags is not downwardly compatible

Issue Type: Bug Created: 2010-05-13T01:47:53.000+0000 Last Updated: 2010-05-14T12:21:48.000+0000 Status: Resolved Fix version(s): - 1.10.5 (26/May/10)

Reporter: Nils Drescher (funktioneer) Assignee: Thomas Weidner (thomas) Tags: - Zend_Filter

Related issues: Attachments:

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

Posted by Thomas Weidner (thomas) on 2010-05-14T12:21:42.000+0000

Implemented with r22170

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts