From 2b0e10eebb0783c6a85afd5516919633065114e2 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 29 Apr 2013 21:31:30 -0400 Subject: [PATCH] Exclude domain names starting with `-` Related to 479aefc438a071d5c7d9e2724f77d8740d57ee77 Refs #3414 --- lib/Cake/Test/Case/Utility/ValidationTest.php | 1 + lib/Cake/Utility/Validation.php | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Cake/Test/Case/Utility/ValidationTest.php b/lib/Cake/Test/Case/Utility/ValidationTest.php index 9b1ea2c84..a001ab5bc 100644 --- a/lib/Cake/Test/Case/Utility/ValidationTest.php +++ b/lib/Cake/Test/Case/Utility/ValidationTest.php @@ -1856,6 +1856,7 @@ class ValidationTest extends CakeTestCase { $this->assertFalse(Validation::url('http://_jabber._tcp.g_mail.com')); $this->assertFalse(Validation::url('http://en.(wikipedia).org/')); $this->assertFalse(Validation::url('http://www.domain.com/fakeenco%ode')); + $this->assertFalse(Validation::url('--.example.com')); $this->assertFalse(Validation::url('www.cakephp.org', true)); $this->assertTrue(Validation::url('http://example.com/~userdir/subdir/index.html')); diff --git a/lib/Cake/Utility/Validation.php b/lib/Cake/Utility/Validation.php index e83d45fdf..fb4e7e49d 100644 --- a/lib/Cake/Utility/Validation.php +++ b/lib/Cake/Utility/Validation.php @@ -1,7 +1,5 @@ '(?:[-_a-z0-9][-_a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,})' + 'hostname' => '(?:[_a-z0-9][-_a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,})' ); /**