ZF-12270: preg_match(): Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff)

Description

Zend_Validate_Hostname fails with error "preg_match(): Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 9" in Validate/Hostname.php on line 598. This happens if you try to validate a hostname that ends with .com.

The component is called by Zend_Validate_EmailAddress, used by a form element, like: $el->addValidator("EmailAddress");

It seems it only failes when using PCRE 8.30. When using 8.13 there are no issues.

Test case:


$regexChars = include('Zend/Validate/Hostname/Com.php');
foreach ($regexChars as $i => $regexChar) {
    try {
        $status = preg_match($regexChar, "hotmail.com");
    }
    catch (\ErrorException $e) {
        print $i . " => " . $e->getMessage() . "\n";
        print "      " . $regexChar . "\n";
    }
}

This fails at entries 71 and 72:

71 => preg_match(): Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 9
      /^[\x{D800}-\x{DB7F}]{1,63}$/iu
72 => preg_match(): Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 9
      /^[\x{DC00}-\x{DFFF}]{1,63}$/iu

Comments

No comments to display