I have the following string:
<p>
This is a test
</p>
<p>
More test text.
</p>
<p>
<a href="http://www.google.com/">google</a>
</p>
When I run that through HTMLPurifier using this code:
require_once(__DIR__ . '/../libraries/htmlpurifier-4.6.0-lite/library/HTMLPurifier.auto.php');
$config = \HTMLPurifier_Config::createDefault();
$config->set('HTML.Allowed', 'code,span,div,label,a,br,p,b,i,del,strike,u,img,video,audio,blockquote,mark,cite,small,ul,ol,li,hr,dl,dt,dd,sup,sub,big,pre,code,figure,figcaption,strong,em,table,tr,td,th,tbody,thead,tfoot,h1,h2,h3,h4,h5,h6');
$purifier = new \HTMLPurifier($config);
$sanitized = !empty($_POST['text'])?$purifier->purify($_POST['text']):null;
I get the error:
Allowed memory size of 134217728 bytes exhausted (tried to allocate 51746711 bytes)
Why is this happening?
EDIT:
Changing the config line to this:
$config->set('HTML.Allowed', 'code,span,div,label');
Results in this error:
Allowed memory size of 134217728 bytes exhausted (tried to allocate 37415543 bytes)