mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Revert "Change URL Validation to use filter_var"
This reverts commit 4e53916021
.
This commit is contained in:
parent
4e53916021
commit
da3103379e
1 changed files with 8 additions and 5 deletions
|
@ -666,11 +666,14 @@ class Validation {
|
|||
* @return boolean Success
|
||||
*/
|
||||
public static function url($check, $strict = false) {
|
||||
$flags = array(FILTER_FLAG_HOST_REQUIRED);
|
||||
if ($strict === true) {
|
||||
$flags[] = FILTER_FLAG_SCHEME_REQUIRED;
|
||||
}
|
||||
return (boolean)filter_var($check, FILTER_VALIDATE_URL, $flags);
|
||||
self::__populateIp();
|
||||
$validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~') . '\/0-9a-z]|(%[0-9a-f]{2}))';
|
||||
$regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
|
||||
'(?:' . self::$__pattern['IPv4'] . '|' . self::$__pattern['hostname'] . ')(?::[1-9][0-9]{0,3})?' .
|
||||
'(?:\/?|\/' . $validChars . '*)?' .
|
||||
'(?:\?' . $validChars . '*)?' .
|
||||
'(?:#' . $validChars . '*)?$/i';
|
||||
return self::_check($check, $regex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue