Skip to content

Commit bcb461e

Browse files
committed
CHG: update HTML Purifier from 4.14.0-master-1dd3e52 dev-release to 4.15.0
1 parent caf030a commit bcb461e

File tree

3 files changed

+61
-17
lines changed

3 files changed

+61
-17
lines changed

CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Version 1.1.26 under development
55
--------------------------------
66

77
- Enh #4386: Added support for PHP 8.1 (marcovtwout, JonathanArgentao, ivany4, csears123)
8-
- Enh #4386: Updated HTMLPurifier to version 4.14.0-master-1dd3e52 for PHP 8.1 support (https://github.com/ezyang/htmlpurifier/blob/v4.14.0/NEWS) (marcovtwout)
8+
- Enh #4386: Updated HTMLPurifier to version 4.15.0 for PHP 8.1 support (https://github.com/ezyang/htmlpurifier/blob/v4.15.0/NEWS) (marcovtwout)
99
- Enh #4392: Added support for SSL to CRedisCache (andres101)
1010
- Bug #4453: Alpine Linux compatibility: Avoid using `GLOB_BRACE` in `CFileHelper::removeDirectory` (ivany4)
1111

framework/vendors/README.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ <h1>Third-Party Library List</h1>
8484
<td><a href="https://www.yiiframework.com/doc/api/1.1/CGettextMoFile">CGettextMoFile</a></td>
8585
</tr>
8686
<tr>
87-
<td><a href="http://htmlpurifier.org/">HTML Purifier</a> (v4.14.0-master-1dd3e52)</td>
87+
<td><a href="http://htmlpurifier.org/">HTML Purifier</a> (v4.15.0)</td>
8888
<td><a href="htmlpurifier/LICENSE.txt">LGPL</a></td>
8989
<td><a href="https://www.yiiframework.com/doc/api/1.1/CHtmlPurifier">CHtmlPurifier</a></td>
9090
</tr>

framework/vendors/htmlpurifier/HTMLPurifier.standalone.php

Lines changed: 59 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
* primary concern and you are using an opcode cache. PLEASE DO NOT EDIT THIS
88
* FILE, changes will be overwritten the next time the script is run.
99
*
10-
* @version 4.14.0-master-1dd3e52
11-
* Build manually:
12-
* - checkout https://github.com/ezyang/htmlpurifier/commit/1dd3e52365c32a142fb7c9c9f8f038f18e353270
13-
* - php maintainance/generate-standalone.php
10+
* @version 4.15.0
1411
*
1512
* @warning
1613
* You must *not* include any other HTML Purifier files before this file,
@@ -42,7 +39,7 @@
4239
*/
4340

4441
/*
45-
HTML Purifier 4.14.0 - Standards Compliant HTML Filtering
42+
HTML Purifier 4.15.0 - Standards Compliant HTML Filtering
4643
Copyright (C) 2006-2008 Edward Z. Yang
4744

4845
This library is free software; you can redistribute it and/or
@@ -81,12 +78,12 @@ class HTMLPurifier
8178
* Version of HTML Purifier.
8279
* @type string
8380
*/
84-
public $version = '4.14.0';
81+
public $version = '4.15.0';
8582

8683
/**
8784
* Constant with version of HTML Purifier.
8885
*/
89-
const VERSION = '4.14.0';
86+
const VERSION = '4.15.0';
9087

9188
/**
9289
* Global configuration object.
@@ -789,6 +786,7 @@ public function __construct()
789786
$this->info['IAlign'] = self::makeEnum('top,middle,bottom,left,right');
790787
$this->info['LAlign'] = self::makeEnum('top,bottom,left,right');
791788
$this->info['FrameTarget'] = new HTMLPurifier_AttrDef_HTML_FrameTarget();
789+
$this->info['ContentEditable'] = new HTMLPurifier_AttrDef_HTML_ContentEditable();
792790

793791
// unimplemented aliases
794792
$this->info['ContentType'] = new HTMLPurifier_AttrDef_Text();
@@ -1830,7 +1828,7 @@ class HTMLPurifier_Config
18301828
* HTML Purifier's version
18311829
* @type string
18321830
*/
1833-
public $version = '4.14.0';
1831+
public $version = '4.15.0';
18341832

18351833
/**
18361834
* Whether or not to automatically finalize
@@ -4243,8 +4241,8 @@ public static function convertToUTF8($str, $config, $context)
42434241
// characters to their true byte-wise ASCII/UTF-8 equivalents.
42444242
$str = strtr($str, self::testEncodingSupportsASCII($encoding));
42454243
return $str;
4246-
} elseif ($encoding === 'iso-8859-1') {
4247-
$str = utf8_encode($str);
4244+
} elseif ($encoding === 'iso-8859-1' && function_exists('mb_convert_encoding')) {
4245+
$str = mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1');
42484246
return $str;
42494247
}
42504248
$bug = HTMLPurifier_Encoder::testIconvTruncateBug();
@@ -4295,8 +4293,8 @@ public static function convertFromUTF8($str, $config, $context)
42954293
// Normal stuff
42964294
$str = self::iconv('utf-8', $encoding . '//IGNORE', $str);
42974295
return $str;
4298-
} elseif ($encoding === 'iso-8859-1') {
4299-
$str = utf8_decode($str);
4296+
} elseif ($encoding === 'iso-8859-1' && function_exists('mb_convert_encoding')) {
4297+
$str = mb_convert_encoding($str, 'ISO-8859-1', 'UTF-8');
43004298
return $str;
43014299
}
43024300
trigger_error('Encoding not supported', E_USER_ERROR);
@@ -7691,6 +7689,11 @@ class HTMLPurifier_Lexer
76917689
*/
76927690
public $tracksLineNumbers = false;
76937691

7692+
/**
7693+
* @type HTMLPurifier_EntityParser
7694+
*/
7695+
private $_entity_parser;
7696+
76947697
// -- STATIC ----------------------------------------------------------
76957698

76967699
/**
@@ -12885,6 +12888,23 @@ public function validate($string, $config, $context)
1288512888

1288612889

1288712890

12891+
class HTMLPurifier_AttrDef_HTML_ContentEditable extends HTMLPurifier_AttrDef
12892+
{
12893+
public function validate($string, $config, $context)
12894+
{
12895+
$allowed = array('false');
12896+
if ($config->get('HTML.Trusted')) {
12897+
$allowed = array('', 'true', 'false');
12898+
}
12899+
12900+
$enum = new HTMLPurifier_AttrDef_Enum($allowed);
12901+
12902+
return $enum->validate($string, $config, $context);
12903+
}
12904+
}
12905+
12906+
12907+
1288812908
/**
1288912909
* Special-case enum attribute definition that lazy loads allowed frame targets
1289012910
*/
@@ -14153,6 +14173,11 @@ public function transform($attr, $config, $context)
1415314173
class HTMLPurifier_AttrTransform_NameSync extends HTMLPurifier_AttrTransform
1415414174
{
1415514175

14176+
/**
14177+
* @type HTMLPurifier_AttrDef_HTML_ID
14178+
*/
14179+
public $idDef;
14180+
1415614181
public function __construct()
1415714182
{
1415814183
$this->idDef = new HTMLPurifier_AttrDef_HTML_ID();
@@ -14319,6 +14344,11 @@ class HTMLPurifier_AttrTransform_SafeParam extends HTMLPurifier_AttrTransform
1431914344
*/
1432014345
private $uri;
1432114346

14347+
/**
14348+
* @type HTMLPurifier_AttrDef_Enum
14349+
*/
14350+
public $wmode;
14351+
1432214352
public function __construct()
1432314353
{
1432414354
$this->uri = new HTMLPurifier_AttrDef_URI(true); // embedded
@@ -14781,6 +14811,8 @@ class HTMLPurifier_ChildDef_List extends HTMLPurifier_ChildDef
1478114811
// XXX: This whole business with 'wrap' is all a bit unsatisfactory
1478214812
public $elements = array('li' => true, 'ul' => true, 'ol' => true);
1478314813

14814+
public $whitespace;
14815+
1478414816
/**
1478514817
* @param array $children
1478614818
* @param HTMLPurifier_Config $config
@@ -16082,6 +16114,7 @@ class HTMLPurifier_HTMLModule_CommonAttributes extends HTMLPurifier_HTMLModule
1608216114
'class' => 'Class',
1608316115
'id' => 'ID',
1608416116
'title' => 'CDATA',
16117+
'contenteditable' => 'ContentEditable',
1608516118
),
1608616119
'Lang' => array(),
1608716120
'I18N' => array(
@@ -18774,6 +18807,16 @@ class HTMLPurifier_Injector_RemoveSpansWithoutAttributes extends HTMLPurifier_In
1877418807
*/
1877518808
private $context;
1877618809

18810+
/**
18811+
* @type SplObjectStorage
18812+
*/
18813+
private $markForDeletion;
18814+
18815+
public function __construct()
18816+
{
18817+
$this->markForDeletion = new SplObjectStorage();
18818+
}
18819+
1877718820
public function prepare($config, $context)
1877818821
{
1877918822
$this->attrValidator = new HTMLPurifier_AttrValidator();
@@ -18807,7 +18850,7 @@ public function handleElement(&$token)
1880718850

1880818851
if ($current instanceof HTMLPurifier_Token_End && $current->name === 'span') {
1880918852
// Mark closing span tag for deletion
18810-
$current->markForDeletion = true;
18853+
$this->markForDeletion->attach($current);
1881118854
// Delete open span tag
1881218855
$token = false;
1881318856
}
@@ -18818,7 +18861,8 @@ public function handleElement(&$token)
1881818861
*/
1881918862
public function handleEnd(&$token)
1882018863
{
18821-
if ($token->markForDeletion) {
18864+
if ($this->markForDeletion->contains($token)) {
18865+
$this->markForDeletion->detach($token);
1882218866
$token = false;
1882318867
}
1882418868
}
@@ -21642,7 +21686,7 @@ public function prepare($config)
2164221686
public function filter(&$uri, $config, $context)
2164321687
{
2164421688
foreach ($this->blacklist as $blacklisted_host_fragment) {
21645-
if (strpos($uri->host, $blacklisted_host_fragment) !== false) {
21689+
if ($uri->host !== null && strpos($uri->host, $blacklisted_host_fragment) !== false) {
2164621690
return false;
2164721691
}
2164821692
}

0 commit comments

Comments
 (0)