Browse Source

Prevent the PCRE error: preg_match(): Compilation failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff)

- removed the testCom() test as it did not fail even when other tests were failing (the Unicode error is related to IDN domain, not to standard .com domain)
- Fixes #322
Martin Hujer 11 years ago
parent
commit
91a54c9363

+ 1 - 1
library/Zend/Validate/Hostname.php

@@ -1484,7 +1484,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
                         // Check each domain part
                         $checked = false;
                         foreach($regexChars as $regexKey => $regexChar) {
-                            $status = @preg_match($regexChar, $domainPart);
+                            $status = preg_match($regexChar, $domainPart);
                             if ($status > 0) {
                                 $length = 63;
                                 if (array_key_exists(strtoupper($this->_tld), $this->_idnLength)

+ 0 - 2
library/Zend/Validate/Hostname/Com.php

@@ -184,8 +184,6 @@ return array(
     68 => '/^[\x{A000}-\x{A48F}]{1,63}$/iu',
     69 => '/^[\x{A490}-\x{A4CF}]{1,63}$/iu',
     70 => '/^[\x{AC00}-\x{D7AF}]{1,63}$/iu',
-    71 => '/^[\x{D800}-\x{DB7F}]{1,63}$/iu',
-    72 => '/^[\x{DC00}-\x{DFFF}]{1,63}$/iu',
     73 => '/^[\x{F900}-\x{FAFF}]{1,63}$/iu',
     74 => '/^[\x{FB00}-\x{FB4F}]{1,63}$/iu',
     75 => '/^[\x{FB50}-\x{FDFF}]{1,63}$/iu',

+ 0 - 9
tests/Zend/Validate/HostnameTest.php

@@ -527,13 +527,4 @@ class Zend_Validate_HostnameTest extends PHPUnit_Framework_TestCase
         $validator = new Zend_Validate_Hostname();
         $this->assertTrue($validator->isValid('mysite.vermögensberater'));
     }
-
-    /**
-     * @group GH-322
-     */
-    public function testCom()
-    {
-        $validator = new Zend_Validate_Hostname();
-        $this->assertTrue($validator->isValid('example.com'));
-    }
 }