Update to ezyang/htmlpurifier 4.14.*
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 4 May 2022 15:32:26 +0000 (17:32 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 4 May 2022 15:32:26 +0000 (17:32 +0200)
19 files changed:
wcfsetup/install/files/lib/system/api/composer.json
wcfsetup/install/files/lib/system/api/composer.lock
wcfsetup/install/files/lib/system/api/composer/installed.json
wcfsetup/install/files/lib/system/api/composer/installed.php
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/README.md
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/VERSION
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/composer.json
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier.autoload-legacy.php
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier.autoload.php
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier.includes.php
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier.php
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier/CSSDefinition.php
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Table.php
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier/Config.php
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule.php
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Tidy.php
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier/Injector/Linkify.php

index eaa83a539524f6c345944516198c5eea02cc212f..24d92756a62211c10cc6abb5d70c147d7b66a208 100644 (file)
@@ -11,7 +11,7 @@
     "require": {
         "chrisjean/php-ico": "1.0.*",
         "erusev/parsedown": "1.7.*",
-        "ezyang/htmlpurifier": "4.13.*",
+        "ezyang/htmlpurifier": "4.14.*",
         "guzzlehttp/guzzle": "^7.3.0",
         "guzzlehttp/psr7": "^2.2",
         "laminas/laminas-diactoros": "^2.4",
index 28435f3d331ff863d5bedf7ebe3471b25a92bcb4..50901620a9e50eca5b621ef8148cb80de5a77ab2 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "fcd5171261f4dccc242c6b38d0274dc2",
+    "content-hash": "d119751db97873765f95dfcb3572783d",
     "packages": [
         {
             "name": "chrisjean/php-ico",
         },
         {
             "name": "ezyang/htmlpurifier",
-            "version": "v4.13.0",
+            "version": "v4.14.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/ezyang/htmlpurifier.git",
-                "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75"
+                "reference": "12ab42bd6e742c70c0a52f7b82477fcd44e64b75"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/08e27c97e4c6ed02f37c5b2b20488046c8d90d75",
-                "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75",
+                "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/12ab42bd6e742c70c0a52f7b82477fcd44e64b75",
+                "reference": "12ab42bd6e742c70c0a52f7b82477fcd44e64b75",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.2"
             },
-            "require-dev": {
-                "simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd"
-            },
             "type": "library",
             "autoload": {
                 "files": [
             ],
             "support": {
                 "issues": "https://github.com/ezyang/htmlpurifier/issues",
-                "source": "https://github.com/ezyang/htmlpurifier/tree/master"
+                "source": "https://github.com/ezyang/htmlpurifier/tree/v4.14.0"
             },
-            "time": "2020-06-29T00:56:53+00:00"
+            "time": "2021-12-25T01:21:49+00:00"
         },
         {
             "name": "guzzlehttp/guzzle",
index 8bce5a2a68bda93c558189ae040e92e3d66f25af..da8af9a7fd26e9fb5f6f15dfbae2733447fe8214 100644 (file)
         },
         {
             "name": "ezyang/htmlpurifier",
-            "version": "v4.13.0",
-            "version_normalized": "4.13.0.0",
+            "version": "v4.14.0",
+            "version_normalized": "4.14.0.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/ezyang/htmlpurifier.git",
-                "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75"
+                "reference": "12ab42bd6e742c70c0a52f7b82477fcd44e64b75"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/08e27c97e4c6ed02f37c5b2b20488046c8d90d75",
-                "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75",
+                "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/12ab42bd6e742c70c0a52f7b82477fcd44e64b75",
+                "reference": "12ab42bd6e742c70c0a52f7b82477fcd44e64b75",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.2"
             },
-            "require-dev": {
-                "simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd"
-            },
-            "time": "2020-06-29T00:56:53+00:00",
+            "time": "2021-12-25T01:21:49+00:00",
             "type": "library",
             "installation-source": "dist",
             "autoload": {
-                "psr-0": {
-                    "HTMLPurifier": "library/"
-                },
                 "files": [
                     "library/HTMLPurifier.composer.php"
                 ],
+                "psr-0": {
+                    "HTMLPurifier": "library/"
+                },
                 "exclude-from-classmap": [
                     "/library/HTMLPurifier/Language/"
                 ]
             "keywords": [
                 "html"
             ],
+            "support": {
+                "issues": "https://github.com/ezyang/htmlpurifier/issues",
+                "source": "https://github.com/ezyang/htmlpurifier/tree/v4.14.0"
+            },
             "install-path": "../ezyang/htmlpurifier"
         },
         {
index fea1467849536d7ef1f9790143fa7e9272e6656e..70da23125bebb64f4e436d43093de7757016548b 100644 (file)
             'dev_requirement' => false,
         ),
         'ezyang/htmlpurifier' => array(
-            'pretty_version' => 'v4.13.0',
-            'version' => '4.13.0.0',
+            'pretty_version' => 'v4.14.0',
+            'version' => '4.14.0.0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../ezyang/htmlpurifier',
             'aliases' => array(),
-            'reference' => '08e27c97e4c6ed02f37c5b2b20488046c8d90d75',
+            'reference' => '12ab42bd6e742c70c0a52f7b82477fcd44e64b75',
             'dev_requirement' => false,
         ),
         'guzzlehttp/guzzle' => array(
index 9e0becc0ae521bb5eaadacd40a2391025f58d45d..e6b7199c12733ac5b716173dc0fb0ac882033ed8 100644 (file)
@@ -1,4 +1,4 @@
-HTML Purifier [![Build Status](https://secure.travis-ci.org/ezyang/htmlpurifier.svg?branch=master)](http://travis-ci.org/ezyang/htmlpurifier)
+HTML Purifier [![Build Status](https://github.com/ezyang/htmlpurifier/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/ezyang/htmlpurifier/actions/workflows/ci.yml)
 =============
 
 HTML Purifier is an HTML filtering solution that uses a unique combination
index 01b73abe5507dc1b2b6be506a84786bc3bbeb514..09ce0ce71bd318415b897c1e4747e0960e2029ad 100644 (file)
@@ -1 +1 @@
-4.13.0
\ No newline at end of file
+4.14.0
\ No newline at end of file
index 0ff86b5df483cfcb7549753d3ac35ebaa54865a8..5f62d889dce53fe73e9e48bae45a15059f3a374e 100644 (file)
@@ -15,9 +15,6 @@
     "require": {
         "php": ">=5.2"
     },
-    "require-dev": {
-        "simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd"
-    },
     "autoload": {
         "psr-0": { "HTMLPurifier": "library/" },
         "files": ["library/HTMLPurifier.composer.php"],
index c271cd1588a03ed0cce6c8e0225f74731bea4a89..0a17ee4addfc0c7d36f93f234273c15970fd9e76 100644 (file)
@@ -4,12 +4,11 @@
  * @file
  * Legacy autoloader for systems lacking spl_autoload_register
  *
- * Must be separate to prevent deprecation warning on PHP 7.2
  */
 
-function __autoload($class)
+spl_autoload_register(function($class)
 {
-    return HTMLPurifier_Bootstrap::autoload($class);
-}
+     return HTMLPurifier_Bootstrap::autoload($class);
+});
 
 // vim: et sw=4 sts=4
index 9d8d299261de1ff49251ecc7500d7779a831a988..7a691132fa7ffd72341576e223c4528068da5d66 100644 (file)
@@ -17,6 +17,7 @@ if (function_exists('spl_autoload_register') && function_exists('spl_autoload_un
     require dirname(__FILE__) . '/HTMLPurifier.autoload-legacy.php';
 }
 
+// phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.zend_ze1_compatibility_modeRemoved
 if (ini_get('zend.ze1_compatibility_mode')) {
     trigger_error("HTML Purifier is not compatible with zend.ze1_compatibility_mode; please turn it off", E_USER_ERROR);
 }
index 151e6752dfa58d6979c94db1f8f47844fc87167d..ee81cac68b957cbf635f9581b3bbee8383f47535 100644 (file)
@@ -7,7 +7,7 @@
  * primary concern and you are using an opcode cache. PLEASE DO NOT EDIT THIS
  * FILE, changes will be overwritten the next time the script is run.
  *
- * @version 4.13.0
+ * @version 4.14.0
  *
  * @warning
  *      You must *not* include any other HTML Purifier files before this file,
index 3c0f8a0ece5ba930e29391ae572497883daa00b0..2177fc851726e03a72fcf76fcb1a3a11285a94eb 100644 (file)
@@ -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.
index 7f1ea3b0f1debcbf497b5e284b3bf3b96bb39ccf..28c49883a72ec88651168f9c6201de1a6eeb52f7 100644 (file)
@@ -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
 
index 21f1a5899d86c48aa1fce6c13feca2fb78f440a3..3f08b81c545b2ad1854190f60b94c6b7fb295fb1 100644 (file)
@@ -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'] =
index cb6b3e6cdc25f4a15a9f6fe03f0477c61a8da2fd..67c7e9535be8f45ff5b482daca7a503bc9c28901 100644 (file)
@@ -164,7 +164,7 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
             }
         }
 
-        if (empty($content)) {
+        if (empty($content) && $thead === false && $tfoot === false) {
             return false;
         }
 
index 3133d8a4ff6888792a165bcab9cbccb35ee091a0..16a6b322b5e33c07f844b6c28869298a34bd41b4 100644 (file)
@@ -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();
index 6d898f80cd053570f7f7715dcb83138742f8ce38..9dbb987290546d1090d3445f271d99d220280b3e 100644 (file)
@@ -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) {
index 08aa23247032afd76e6754aa2cf7e76a0a17f47c..12173ba700a7adbc641961212beab52ffa1c6659 100644 (file)
@@ -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;
index 700a25dbceb6f4cc300b4b85726055d5bada8a92..9ee3ffcc989aff94429eb39f274f0064f0c4897b 100644 (file)
@@ -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;
index 74f83eaa7d16ad8a5e4455243756e46559b4082a..3b6d70f6e7c458c5839db28cf55c6a77b3f1c1af 100644 (file)
@@ -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();