diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 16fe6c50aa1..c234a15a374 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -1257,7 +1257,7 @@ class Conf extends stdClass if (!isset($this->MAIN_RESTRICTHTML_ONLY_VALID_HTML)) { $this->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1; } - if (!isset($this->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY)) { + if (!isset($this->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY) && extension_loaded('tidy') && class_exists("tidy")) { $this->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; } diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 743b6d33c8e..4991e1d16bd 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -772,9 +772,11 @@ class SecurityTest extends CommonClassTest // Set options for cleaning data $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions - // Enabled option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible + // Enable option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible if (extension_loaded('tidy') && class_exists("tidy")) { $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; + } else { + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; } $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions