Zend Framework

Zend_Filter_StripTags is not downwardly compatible

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.10.0
  • Fix Version/s: 1.10.5
  • Component/s: Zend_Filter
  • Labels:
    None

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!!!!

Activity

Hide
Thomas Weidner added a comment -

Implemented with r22170

Show
Thomas Weidner added a comment - Implemented with r22170

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: