mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fix URL validation to allow underscores in subdomain.
This commit is contained in:
parent
3b46cd43f1
commit
e7c4064a69
2 changed files with 5 additions and 1 deletions
|
@ -1782,6 +1782,10 @@ class ValidationTest extends CakeTestCase {
|
|||
$this->assertFalse(Validation::url('www.cakephp.org', true));
|
||||
$this->assertTrue(Validation::url('http://www.cakephp.org', true));
|
||||
$this->assertTrue(Validation::url('http://example.com/~userdir/'));
|
||||
$this->assertTrue(Validation::url('http://underscore_subdomain.example.org'));
|
||||
$this->assertTrue(Validation::url('http://_jabber._tcp.gmail.com'));
|
||||
$this->assertFalse(Validation::url('http://www.underscore_domain.org'));
|
||||
$this->assertFalse(Validation::url('http://_jabber._tcp.g_mail.com'));
|
||||
|
||||
$this->assertTrue(Validation::url('http://example.com/~userdir/subdir/index.html'));
|
||||
$this->assertTrue(Validation::url('http://www.zwischenraume.de'));
|
||||
|
|
|
@ -38,7 +38,7 @@ class Validation {
|
|||
* @var array
|
||||
*/
|
||||
protected static $_pattern = array(
|
||||
'hostname' => '(?:[a-z0-9][-a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,4}|museum|travel)'
|
||||
'hostname' => '(?:[-_a-z0-9][-_a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,4}|museum|travel)'
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue