symfony/polyfill-intl-idn
Provides polyfills for the Intl IDN functions idn_to_ascii() and idn_to_utf8(), enabling Internationalized Domain Name conversion on PHP installations without the intl extension. Part of Symfony’s Polyfill suite, MIT licensed.
CVE-2026-46644) to reject xn-- labels that decode to ASCII-only strings, aligning with RFC 3492 compliance. This strengthens Laravel’s IDN handling in security-sensitive contexts (e.g., email validation, DNS resolution).Intl extension.idn_to_ascii/idn_to_utf8 signatures remain unchanged). Existing Laravel integrations (e.g., custom validation rules, URL helpers) require no updates.xn-- labels, which are edge cases unlikely to impact most applications.Str::of()) can be extended to include xn-- label validation scenarios.xn-- labels if the Punycode payload incorrectly decodes to ASCII. Test with real-world IDN datasets (e.g., bücher.xn--bcher-kva.ch).Intl extension standardizes stricter IDN validation, the polyfill may need future adjustments. Monitor PHP RFCs and Symfony polyfill updates.xn-- label generators in the codebase that may now fail validation?bücher.ch to xn--bcher-kva.ch might now reject the output if misconfigured.xn-- labels?idn_to_ascii() returns false due to the security check, should the app:
iconv())?xn-- labels (e.g., homograph attacks)?xn--80ak6aa92e (decodes to example.com).xn--90a3ac (decodes to äxample.com).xn-- label usage in future PRs (e.g., grep "xn--" .)?Illuminate\Validation\Rules\Domain)?symfony/polyfill-intl-normalizer).Intl Extension: Still the preferred long-term solution for performance and security, but requires server-level changes.xn-- label handling (e.g., in DNS resolution, email parsing).idn_to_ascii always succeeding (now may return false).composer.json to v1.38.1:
"require": {
"symfony/polyfill-intl-idn": "^1.38.1"
}
composer update symfony/polyfill-intl-idn --with-dependencies.xn-- labels:
use Symfony\Component\Polyfill\Intl\Idn\IdnToAscii;
public function testSecurityFix()
{
$idn = new IdnToAscii();
// Should return false (rejected)
$this->assertFalse($idn('xn--example-ascii')); // Hypothetical ASCII-only xn--
// Should succeed
$this->assertEquals('xn--bcher-kva', $idn('bücher'));
}
Illuminate\Validation\Rules\Domain to handle false returns from idn_to_ascii.Illuminate\Support\Facades\URL gracefully handles rejected xn-- labels (e.g., fallback to ASCII).false returns and implement a fallback (e.g., iconv()).xn-- Labels: Test with real-world examples (e.g., xn--fiqs8s for fidelity.com).xn-- labels (e.g., xn--80ak6aa92e for 例.测试).v1.38.1 and verify no regressions in existing IDN workflows.xn-- label rejection.ValidIdn) to handle false returns:
public function passes($attribute, $value)
{
$ascii = Idn::toAscii($value);
return $ascii !== false && filter_var($ascii, FILTER_VALIDATE_DOMAIN) !== false;
}
xn-- labels).xn-- label handling.How can I help you explore Laravel packages today?