HTMLPurifier Breaking Images

I try to run HTMLPurifier when the user enters WYSIWYG (CK editor) and the images break.

Unfiltered Input:

<img alt="laugh" src="/lib/ckeditor/plugins/smiley/images/teeth_smile.gif" title="laugh">

After starting the cleaner with the default settings:

<img alt="&quot;laugh&quot;" src="%5C" title="&quot;laugh&quot;">

I tried to change the configuration settings; but i never save src. Any thoughts?

+3
source share
4 answers

I have a suspicion that magic_quotes might be the reason ..?

Also you tried $config->set('Core.RemoveInvalidImg',true);. Which version are you using? (Try an older or newer one)

+4
source

There was the same problem. It fixed it

if (get_magic_quotes_gpc()) {
function stripslashes_gpc(&$value)
{
    $value = stripslashes($value);
}
array_walk_recursive($_GET, 'stripslashes_gpc');
array_walk_recursive($_POST, 'stripslashes_gpc');
array_walk_recursive($_COOKIE, 'stripslashes_gpc');
array_walk_recursive($_REQUEST, 'stripslashes_gpc');

}

+3
source

, htmlpurifier, img, , ( ) . , , , . % 5C - URL . , , . ? HTML Tidy?

+1

, , , .

, , .htaccess

php_flag magic_quotes_gpc Off

From the PHP documentation "This function has been DEPRECATED since PHP 5.3.0 and removed from PHP 5.4.0" http://www.php.net/manual/en/security.magicquotes.what.php

In addition, there are other ways to disable magic quotes http://www.php.net/manual/en/security.magicquotes.disabling.php

+1
source

Source: https://habr.com/ru/post/1768739/


All Articles