mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding unicode letters and numbers to url path segment regex.
Test case added. Fixes #1284
This commit is contained in:
parent
96b30f0547
commit
44b09171ef
2 changed files with 3 additions and 2 deletions
|
@ -874,13 +874,13 @@ class Validation extends Object {
|
|||
$_this =& Validation::getInstance();
|
||||
$_this->__populateIp();
|
||||
$_this->check = $check;
|
||||
$validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~') . '\/0-9a-z]|(%[0-9a-f]{2}))';
|
||||
$validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~') . '\/0-9a-z\p{L}\p{N}]|(%[0-9a-f]{2}))';
|
||||
$_this->regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
|
||||
'(?:' . $_this->__pattern['IPv4'] . '|\[' . $_this->__pattern['IPv6'] . '\]|' . $_this->__pattern['hostname'] . ')' .
|
||||
'(?::[1-9][0-9]{0,4})?' .
|
||||
'(?:\/?|\/' . $validChars . '*)?' .
|
||||
'(?:\?' . $validChars . '*)?' .
|
||||
'(?:#' . $validChars . '*)?$/i';
|
||||
'(?:#' . $validChars . '*)?$/iu';
|
||||
return $_this->_check();
|
||||
}
|
||||
|
||||
|
|
|
@ -1879,6 +1879,7 @@ class ValidationTest extends CakeTestCase {
|
|||
$this->assertTrue(Validation::url('http://example.com/~userdir/subdir/index.html'));
|
||||
$this->assertTrue(Validation::url('http://www.zwischenraume.de'));
|
||||
$this->assertTrue(Validation::url('http://www.zwischenraume.cz'));
|
||||
$this->assertTrue(Validation::url('http://www.last.fm/music/浜崎あゆみ'), 'utf8 path failed');
|
||||
|
||||
$this->assertTrue(Validation::url('http://cakephp.org:80'));
|
||||
$this->assertTrue(Validation::url('http://cakephp.org:443'));
|
||||
|
|
Loading…
Reference in a new issue