Skip to content

Commit 15bd0a1

Browse files
authored
Merge pull request #113 from AdeAttwood/master
Fix `html_entity_decode` deprecation warning in PHP 8.1
2 parents 0bd6ae5 + c4d3df9 commit 15bd0a1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Html2Text.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -236,16 +236,17 @@ private function legacyConstruct($html = '', $fromFile = false, array $options =
236236
*/
237237
public function __construct($html = '', $options = array())
238238
{
239+
$this->htmlFuncFlags = (PHP_VERSION_ID < 50400)
240+
? ENT_QUOTES
241+
: ENT_QUOTES | ENT_HTML5;
242+
239243
// for backwards compatibility
240244
if (!is_array($options)) {
241245
return call_user_func_array(array($this, 'legacyConstruct'), func_get_args());
242246
}
243247

244248
$this->html = $html;
245249
$this->options = array_merge($this->options, $options);
246-
$this->htmlFuncFlags = (PHP_VERSION_ID < 50400)
247-
? ENT_QUOTES
248-
: ENT_QUOTES | ENT_HTML5;
249250
}
250251

251252
/**

0 commit comments

Comments
 (0)