Work-around for the IDN extension
authorAlexander Ebert <ebert@woltlab.com>
Sun, 25 Feb 2018 14:38:25 +0000 (15:38 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 25 Feb 2018 14:38:25 +0000 (15:38 +0100)
wcfsetup/install/files/lib/system/api/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php

index a0d44006c104a7e39f3b20dd7224951195b9fda5..fde2b4a92625236a9e0e5c45da56ab85c833688b 100644 (file)
@@ -96,7 +96,9 @@ class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
         }
 
         // PHP 5.3 and later support this functionality natively
-        if (function_exists('idn_to_ascii')) {
+        // WoltLab modification: the IDNA-constant is not available with the IDN-extension
+        // see https://github.com/ezyang/htmlpurifier/issues/168
+        if (function_exists('idn_to_ascii') && defined('IDNA_NONTRANSITIONAL_TO_ASCII') && defined('INTL_IDNA_VARIANT_UTS46')) {
                // WoltLab modification: backport of a change in a to-be-released version for PHP 7.2 compatibility
                // see https://github.com/ezyang/htmlpurifier/commit/ce0ede24ded2e05489f5bab50cc53426599532e4
                $string = idn_to_ascii($string, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);