php - strip_tags removes allowed tags when within attributes -


for reason, php's strig_tags( ) function removing brackets tags explicitly allowed, when tags appear within attribute.

example:

<div data-contents="<p>hello!</p>"></div> 

becomes

<div data-contents="phello!/p"></div> 

i know, know. isn't practice.

regardless, ideas?

as warnings on man page state: **because strip_tags() not validate html, partial or broken tags can result in removal of more text/data expected.

if want embed html inside attribute, must encoded, e.g. should have &lt;p&gt;hello!&lt;/p&gt; instead.

strip tags "dumb" , remove looks tag, regardless of tag occurs in text, or if result in broken page or not.


Comments

Popular posts from this blog

Need help in packaging app using TideSDK on Windows -

java - Why does my date parsing return a weird date? -

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -