diff --git a/lib/htmlpurifier/HTMLPurifier.php b/lib/htmlpurifier/HTMLPurifier.php
index 35b3affe2a0..7601ab6e626 100644
--- a/lib/htmlpurifier/HTMLPurifier.php
+++ b/lib/htmlpurifier/HTMLPurifier.php
@@ -19,7 +19,7 @@
*/
/*
- HTML Purifier 4.13.0 - Standards Compliant HTML Filtering
+ HTML Purifier 4.14.0 - Standards Compliant HTML Filtering
Copyright (C) 2006-2008 Edward Z. Yang
This library is free software; you can redistribute it and/or
@@ -58,12 +58,12 @@ class HTMLPurifier
* Version of HTML Purifier.
* @type string
*/
- public $version = '4.13.0';
+ public $version = '4.14.0';
/**
* Constant with version of HTML Purifier.
*/
- const VERSION = '4.13.0';
+ const VERSION = '4.14.0';
/**
* Global configuration object.
diff --git a/lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Background.php b/lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Background.php
index ecd6e276e92..2ce4ce9812c 100644
--- a/lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Background.php
+++ b/lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Background.php
@@ -25,6 +25,7 @@ class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
$this->info['background-repeat'] = $def->info['background-repeat'];
$this->info['background-attachment'] = $def->info['background-attachment'];
$this->info['background-position'] = $def->info['background-position'];
+ $this->info['background-size'] = $def->info['background-size'];
}
/**
@@ -53,6 +54,7 @@ class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
$caught['repeat'] = false;
$caught['attachment'] = false;
$caught['position'] = false;
+ $caught['size'] = false;
$i = 0; // number of catches
diff --git a/lib/htmlpurifier/HTMLPurifier/CSSDefinition.php b/lib/htmlpurifier/HTMLPurifier/CSSDefinition.php
index ca3dcd662a1..687ef263d8e 100644
--- a/lib/htmlpurifier/HTMLPurifier/CSSDefinition.php
+++ b/lib/htmlpurifier/HTMLPurifier/CSSDefinition.php
@@ -109,6 +109,22 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
);
$this->info['background-position'] = new HTMLPurifier_AttrDef_CSS_BackgroundPosition();
+ $this->info['background-size'] = new HTMLPurifier_AttrDef_CSS_Composite(
+ array(
+ new HTMLPurifier_AttrDef_Enum(
+ array(
+ 'auto',
+ 'cover',
+ 'contain',
+ 'initial',
+ 'inherit',
+ )
+ ),
+ new HTMLPurifier_AttrDef_CSS_Percentage(),
+ new HTMLPurifier_AttrDef_CSS_Length()
+ )
+ );
+
$border_color =
$this->info['border-top-color'] =
$this->info['border-bottom-color'] =
diff --git a/lib/htmlpurifier/HTMLPurifier/ChildDef/Table.php b/lib/htmlpurifier/HTMLPurifier/ChildDef/Table.php
index 9b12c928039..81733011912 100644
--- a/lib/htmlpurifier/HTMLPurifier/ChildDef/Table.php
+++ b/lib/htmlpurifier/HTMLPurifier/ChildDef/Table.php
@@ -164,7 +164,7 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
}
}
- if (empty($content)) {
+ if (empty($content) && $thead === false && $tfoot === false) {
return false;
}
diff --git a/lib/htmlpurifier/HTMLPurifier/Config.php b/lib/htmlpurifier/HTMLPurifier/Config.php
index 993d6e3f65a..0321fce1efc 100644
--- a/lib/htmlpurifier/HTMLPurifier/Config.php
+++ b/lib/htmlpurifier/HTMLPurifier/Config.php
@@ -21,7 +21,7 @@ class HTMLPurifier_Config
* HTML Purifier's version
* @type string
*/
- public $version = '4.13.0';
+ public $version = '4.14.0';
/**
* Whether or not to automatically finalize
@@ -803,7 +803,7 @@ class HTMLPurifier_Config
if ($index !== false) {
$array = (isset($array[$index]) && is_array($array[$index])) ? $array[$index] : array();
}
- $mq = $mq_fix && function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc();
+ $mq = $mq_fix && version_compare(PHP_VERSION, '7.4.0', '<') && function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc();
$allowed = HTMLPurifier_Config::getAllowedDirectivesForForm($allowed, $schema);
$ret = array();
diff --git a/lib/htmlpurifier/HTMLPurifier/HTMLModule.php b/lib/htmlpurifier/HTMLPurifier/HTMLModule.php
index a94b8ea4cf5..acd620d2386 100644
--- a/lib/htmlpurifier/HTMLPurifier/HTMLModule.php
+++ b/lib/htmlpurifier/HTMLPurifier/HTMLModule.php
@@ -257,8 +257,9 @@ class HTMLPurifier_HTMLModule
*/
public function makeLookup($list)
{
+ $args = func_get_args();
if (is_string($list)) {
- $list = func_get_args();
+ $list = $args;
}
$ret = array();
foreach ($list as $value) {
diff --git a/lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php b/lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php
index f482a3741fe..0eb875a2193 100644
--- a/lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php
+++ b/lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php
@@ -146,10 +146,7 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
$type = "info_$type";
$e = $this;
}
- // PHP does some weird parsing when I do
- // $e->$type[$attr], so I have to assign a ref.
- $f =& $e->$type;
- $f[$attr] = $fix;
+ $e->{$type}[$attr] = $fix;
break;
case 'tag_transform':
$this->info_tag_transform[$params['element']] = $fix;
diff --git a/lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php b/lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php
index 8bc63fb7631..fcbf9681e1c 100644
--- a/lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php
+++ b/lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php
@@ -168,9 +168,11 @@ class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule
// @vspace for img ------------------------------------------------
$r['img@vspace'] = new HTMLPurifier_AttrTransform_ImgSpace('vspace');
- // @width for hr, td, th ------------------------------------------
+ // @width for table, hr, td, th, col ------------------------------------------
+ $r['table@width'] =
$r['td@width'] =
$r['th@width'] =
+ $r['col@width'] =
$r['hr@width'] = new HTMLPurifier_AttrTransform_Length('width');
return $r;
diff --git a/lib/htmlpurifier/HTMLPurifier/Injector/Linkify.php b/lib/htmlpurifier/HTMLPurifier/Injector/Linkify.php
index 531dde4acf1..e517a72d298 100644
--- a/lib/htmlpurifier/HTMLPurifier/Injector/Linkify.php
+++ b/lib/htmlpurifier/HTMLPurifier/Injector/Linkify.php
@@ -40,6 +40,9 @@ class HTMLPurifier_Injector_Linkify extends HTMLPurifier_Injector
'/\\b((?:[a-z][\\w\\-]+:(?:\\/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}\\/)(?:[^\\s()<>]|\\((?:[^\\s()<>]|(?:\\([^\\s()<>]+\\)))*\\))+(?:\\((?:[^\\s()<>]|(?:\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:\'".,<>?\x{00ab}\x{00bb}\x{201c}\x{201d}\x{2018}\x{2019}]))/iu',
$token->data, -1, PREG_SPLIT_DELIM_CAPTURE);
+ if ($bits === false) {
+ return;
+ }
$token = array();
diff --git a/lib/htmlpurifier/readme_moodle.txt b/lib/htmlpurifier/readme_moodle.txt
index 12f62c63d02..59d0138a794 100644
--- a/lib/htmlpurifier/readme_moodle.txt
+++ b/lib/htmlpurifier/readme_moodle.txt
@@ -1,4 +1,4 @@
-Description of HTML Purifier v4.12.0 library import into Moodle
+Description of HTML Purifier library import into Moodle
* Make new (or delete contents of) /lib/htmlpurifier/
* Copy everything from /library/ folder to /lib/htmlpurifier/
diff --git a/lib/thirdpartylibs.xml b/lib/thirdpartylibs.xml
index b89e2a30f9d..1018325bc11 100644
--- a/lib/thirdpartylibs.xml
+++ b/lib/thirdpartylibs.xml
@@ -73,7 +73,7 @@
htmlpurifier
HTML Purifier
Filters HTML.
- 4.13.0
+ 4.14.0
LGPL
2.1+
https://github.com/ezyang/htmlpurifier
diff --git a/lib/upgrade.txt b/lib/upgrade.txt
index bc6bececf38..f61908bd5dc 100644
--- a/lib/upgrade.txt
+++ b/lib/upgrade.txt
@@ -2,10 +2,11 @@ This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 4.1 ===
-* A process to deprecate capabilities by flagging them in the access.php by adding a $deprecatedcapabilities variable (an array).
-This array will list the deprecated capabilities and a possible replacement. Once we declare the capability as deprecated, a debugging
-message will be displayed (in DEBUG_DEVELOPPER mode only) when using the deprecated capability.
-Declaration is as follow:
+* HTMLPurifier has been upgraded to the latest version - 4.14.0
+* A process to deprecate capabilities by flagging them in the access.php by adding a $deprecatedcapabilities variable (an array).
+ This array will list the deprecated capabilities and a possible replacement. Once we declare the capability as deprecated, a debugging
+ message will be displayed (in DEBUG_DEVELOPPER mode only) when using the deprecated capability.
+ Declaration is as follow:
$deprecatedcapabilities = [
'fake/access:fakecapability' => ['replacement' => '', 'message' => 'This capability should not be used anymore.']
];