1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-09 16:56:20 +02:00

Added class_exists('Net_IDNA2') around optional external class (#351)

This commit is contained in:
Michael Kliewe
2022-11-19 05:56:21 +01:00
committed by GitHub
parent d567de85e6
commit 2d1314820e

View File

@ -106,7 +106,7 @@ class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
// If we have Net_IDNA2 support, we can support IRIs by
// punycoding them. (This is the most portable thing to do,
// since otherwise we have to assume browsers support
} elseif ($config->get('Core.EnableIDNA')) {
} elseif ($config->get('Core.EnableIDNA') && class_exists('Net_IDNA2')) {
$idna = new Net_IDNA2(array('encoding' => 'utf8', 'overlong' => false, 'strict' => true));
// we need to encode each period separately
$parts = explode('.', $string);