Skip to content

Commit

Permalink
Merge pull request #113 from AdeAttwood/master
Browse files Browse the repository at this point in the history
Fix `html_entity_decode` deprecation warning in PHP 8.1
  • Loading branch information
andrewnicols authored Aug 20, 2024
2 parents 0bd6ae5 + c4d3df9 commit 15bd0a1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Html2Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,17 @@ private function legacyConstruct($html = '', $fromFile = false, array $options =
*/
public function __construct($html = '', $options = array())
{
$this->htmlFuncFlags = (PHP_VERSION_ID < 50400)
? ENT_QUOTES
: ENT_QUOTES | ENT_HTML5;

// for backwards compatibility
if (!is_array($options)) {
return call_user_func_array(array($this, 'legacyConstruct'), func_get_args());
}

$this->html = $html;
$this->options = array_merge($this->options, $options);
$this->htmlFuncFlags = (PHP_VERSION_ID < 50400)
? ENT_QUOTES
: ENT_QUOTES | ENT_HTML5;
}

/**
Expand Down

0 comments on commit 15bd0a1

Please sign in to comment.