note 117793 added to function.strip-tags

From: Date: Tue, 11 Aug 2015 10:17:31 +0000
Subject: note 117793 added to function.strip-tags
Groups: php.notes 
Request: Send a blank email to php-notes+get-203306@lists.php.net to get a copy of this message
"5.3.4 strip_tags() no longer strips self-closing XHTML tags unless the self-closing XHTML tag is also given in allowable_tags." This is poorly worded. The above seems to be saying that, since 5.3.4, if you don't specify "<br/>" in allowable_tags then "<br/>" will not be stripped... but that's not actually what they're trying to say. What it means is, in versions prior to 5.3.4, it "strips self-closing XHTML tags unless the self-closing XHTML tag is also given in allowable_tags", and that since 5.3.4 this is no longer the case. So what reads as "no longer strips self-closing tags (unless the self-closing XHTML tag is also given in allowable_tags)" is actually saying "no longer (strips self-closing tags unless the self-closing XHTML tag is also given in allowable_tags)". i.e. pre-5.3.4: strip_tags('Hello World<br><br/>','<br>') => 'Hello World<br>' // strips <br/> because it wasn't explicitly specified in allowable_tags 5.3.4 and later: strip_tags('Hello World<br><br/>','<br>') => 'Hello World<br><br/>' // does not strip <br/> because PHP matches it with <br> in allowable_tags ---- Server IP: 72.52.91.14 Probable Submitter: 193.120.41.198 ---- Manual Page -- http://php.net/manual/en/function.strip-tags.php Edit -- https://master.php.net/note/edit/117793 Del: integrated -- https://master.php.net/note/delete/117793/integrated Del: useless -- https://master.php.net/note/delete/117793/useless Del: bad code -- https://master.php.net/note/delete/117793/bad+code Del: spam -- https://master.php.net/note/delete/117793/spam Del: non-english -- https://master.php.net/note/delete/117793/non-english Del: in docs -- https://master.php.net/note/delete/117793/in+docs Del: other reasons-- https://master.php.net/note/delete/117793 Reject -- https://master.php.net/note/reject/117793 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#203306) next »