Req #71286 [NEW]: strip_tags should remove non-text chararcters as well

From: Date: Tue, 05 Jan 2016 15:42:25 +0000
Subject: Req #71286 [NEW]: strip_tags should remove non-text chararcters as well
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198428@lists.php.net to get a copy of this message
From: leesleefeng at 163 dot com Operating system: All PHP version: 5.6.16 Package: Strings related Bug Type: Feature/Change Request Bug description:strip_tags should remove non-text chararcters as well Description: ------------ strip_tags should remove non-text chararcters as well. When using strip_tags to remove html and php tags, the purpose is to get plain text. Thus if the tags has codes but not text inside, like style tag and script tag, the codes should be removed as well, not noly the tags. Test script: --------------- $s = <<<html <style type="text/css"> body,h1,h2,h3,h4,h5,h6{padding:0;margin:0;} </style> <script> window.onload = function(){ console.log('document is ready'); } </script> <div> walking through the green fields, sunshine in my eyes </div> html; $text = strip_tags($s); echo $text; Expected result: ---------------- walking through the green fields, sunshine in my eyes Actual result: -------------- body,h1,h2,h3,h4,h5,h6{padding:0;margin:0;} window.onload = function(){ console.log('document is ready'); } walking through the green fields, sunshine in my eyes -- Edit bug report at https://bugs.php.net/bug.php?id=71286&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71286&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71286&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71286&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71286&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71286&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71286&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71286&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71286&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71286&r=support Expected behavior: https://bugs.php.net/fix.php?id=71286&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71286&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71286&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71286&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71286&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71286&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71286&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71286&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71286&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71286&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71286&r=mysqlcfg

« previous php.bugs (#198428) next »