8000 Fix some PHP 8.2 deprecations by TimWolla · Pull Request #319 · ezyang/htmlpurifier · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix some PHP 8.2 deprecations #319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions library/HTMLPurifier/AttrTransform/NameSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
class HTMLPurifier_AttrTransform_NameSync extends HTMLPurifier_AttrTransform
{

/**
* @type HTMLPurifier_AttrDef_HTML_ID
*/
public $idDef;

public function __construct()
{
$this->idDef = new HTMLPurifier_AttrDef_HTML_ID();
Expand Down
2 changes: 2 additions & 0 deletions library/HTMLPurifier/ChildDef/List.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class HTMLPurifier_ChildDef_List extends HTMLPurifier_ChildDef
// XXX: This whole business with 'wrap' is all a bit unsatisfactory
public $elements = array('li' => true, 'ul' => true, 'ol' => true);

public $whitespace;

/**
* @param array $children
* @param HTMLPurifier_Config $config
Expand Down
15 changes: 13 additions & 2 deletions library/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ class HTMLPurifier_Injector_RemoveSpansWithoutAttributes extends HTMLPurifier_In
*/
private $context;

/**
* @type SplObjectStorage
*/
private $markForDeletion;

public function __construct()
{
$this->markForDeletion = new SplObjectStorage();
}

public function prepare($config, $context)
{
$this->attrValidator = new HTMLPurifier_AttrValidator();
Expand Down Expand Up @@ -64,7 +74,7 @@ public function handleElement(&$token)

if ($current instanceof HTMLPurifier_Token_End && $current->name === 'span') {
// Mark closing span tag for deletion
$current->markForDeletion = true;
$this->markForDeletion->attach($current);
// Delete open span tag
$token = false;
}
Expand All @@ -75,7 +85,8 @@ public function handleElement(&$token)
*/
public function handleEnd(&$token)
{
if ($token->markForDeletion) {
if ($this->markForDeletion->contains($token)) {
$this->markForDeletion->detach($token);
$token = false;
}
}
Expand Down
5 changes: 5 additions & 0 deletions library/HTMLPurifier/Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ class HTMLPurifier_Lexer
*/
public $tracksLineNumbers = false;

/**
* @type HTMLPurifier_EntityParser
*/
private $_entity_parser;

// -- STATIC ----------------------------------------------------------

/**
Expand Down
5 changes: 5 additions & 0 deletions tests/HTMLPurifier/AttrTransform/NameSyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
class HTMLPurifier_AttrTransform_NameSyncTest extends HTMLPurifier_AttrTransformHarness
{

/**
* @type HTMLPurifier_IDAccumulator
*/
public $accumulator;

public function setUp()
{
parent::setUp();
Expand Down
5 changes: 5 additions & 0 deletions tests/HTMLPurifier/AttrValidator_ErrorsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
class HTMLPurifier_AttrValidator_ErrorsTest extends HTMLPurifier_ErrorsHarness
{

/**
* @type HTMLPurifier_Language
*/
public $language;

public function setup()
{
parent::setup();
Expand Down
5 changes: 5 additions & 0 deletions tests/HTMLPurifier/URIFilterHarness.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
class HTMLPurifier_URIFilterHarness extends HTMLPurifier_URIHarness
{

/**
* @type HTMLPurifier_URIFilter
*/
public $filter;

protected function assertFiltering($uri, $expect_uri = true)
{
$this->prepareURI($uri, $expect_uri);
Expand Down
0