Bug #74371 [NEW]: strip_tags altering attributes

From: Date: Tue, 04 Apr 2017 18:41:32 +0000
Subject: Bug #74371 [NEW]: strip_tags altering attributes
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208317@lists.php.net to get a copy of this message
From:             php-bugs at aspectis dot net
Operating system: 
PHP version:      7.1.3
Package:          *General Issues
Bug Type:         Bug
Bug description:strip_tags altering attributes

Description:
------------
The manual claims that strip_tags "does not modify any attributes on the
tags that you allow" (http://www.php.net/function.strip-tags), which
unfortunately isn't quite true:

The characters "<" and ">" get stripped from all attribute values.

All versions at least from 5.4 seem to be affected.

Test script:
---------------
echo strip_tags('<img src="example.jpg" alt=":> :<">',
'<img>');


Expected result:
----------------
<img src="example.jpg" alt=":> :<">

Actual result:
--------------
<img src="example.jpg" alt=": :">

-- 
Edit bug report at https://bugs.php.net/bug.php?id=74371&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=74371&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=74371&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=74371&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=74371&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=74371&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=74371&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=74371&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=74371&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=74371&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=74371&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=74371&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=74371&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=74371&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74371&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=74371&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=74371&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=74371&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74371&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=74371&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=74371&r=mysqlcfg



Thread (7 messages)

« previous php.bugs (#208317) next »