Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow utf8mb4 characters in the URL
refs #8368
  • Loading branch information
AntonNguyen committed Oct 7, 2017
1 parent 42f8054 commit ccdbbe1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Validation/Validation.php
Expand Up @@ -908,7 +908,9 @@ public static function range($check, $lower = null, $upper = null)
public static function url($check, $strict = false)
{
static::_populateIp();
$alpha = '0-9\p{L}\p{N}';

$emoji = '\x{1F300}-\x{1F6FF}';
$alpha = '0-9(\p{L}\p{N}' . $emoji;
$hex = '(%[0-9a-f]{2})';
$subDelimiters = preg_quote('/!"$&\'()*+,-.@_:;=~[]', '/');
$path = '([' . $subDelimiters . $alpha . ']|' . $hex . ')';
Expand Down
1 change: 1 addition & 0 deletions tests/TestCase/Validation/ValidationTest.php
Expand Up @@ -2181,6 +2181,7 @@ public function testUrl()
$this->assertTrue(Validation::url('http://www.electrohome.ro/images/239537750-284232-215_300[1].jpg'));
$this->assertTrue(Validation::url('http://www.eräume.foo'));
$this->assertTrue(Validation::url('http://äüö.eräume.foo'));
$this->assertTrue(Validation::url('http://www.domain.com/👹'), 'utf8Extended path failed');

$this->assertTrue(Validation::url('http://cakephp.org:80'));
$this->assertTrue(Validation::url('http://cakephp.org:443'));
Expand Down

0 comments on commit ccdbbe1

Please sign in to comment.