1.2.1645. strip_tags() Skips Closed Tag

strip_tags() skips non-self closing tags. This means that tags such as <br /> will be ignored from the second argument of the function.

<?php

$input = 'a<br />';

// Displays 'a' and clean the tag
echo strip_tags($input, '<br>');

// Displays 'a<br />' and skips the allowed tag
echo strip_tags($input, '<br/>');

?>

See also strip_tags.

1.2.1645.1. Suggestions

  • Do not use self-closing tags in the second parameter

1.2.1645.2. Specs

Short name

Structures/StripTagsSkipsClosedTag

Rulesets

All, Analyze, CE, CI-checks

Exakat since

1.9.3

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Available in

Entreprise Edition, Community Edition, Exakat Cloud