|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-01-05 16:26 UTC] tyrael@php.net
-Status: Open
+Status: Not a bug
[2016-01-05 16:26 UTC] tyrael@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 16:00:01 2025 UTC |
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