Skip to content
Permalink
Browse files

Allow utf8mb4 characters in the URL

refs #8368
  • Loading branch information...
Anton Nguyen
Anton Nguyen committed Oct 7, 2017
1 parent 42f8054 commit ccdbbe1f344bd8072b9f645c1e1a55178d9c3ec3
Showing with 4 additions and 1 deletion.
  1. +3 −1 src/Validation/Validation.php
  2. +1 −0 tests/TestCase/Validation/ValidationTest.php
@@ -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 . ')';
@@ -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'));

0 comments on commit ccdbbe1

Please sign in to comment.
You can’t perform that action at this time.