mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-09-05 07:16:27 +00:00
Fix #724: Remove filter flag constants deprecated as of PHP 7.3
Error messages:
Fatal error: Uncaught Error: Undefined constant "FILTER_FLAG_SCHEME_REQUIRED" in [...]
Fatal error: Uncaught Error: Undefined constant "FILTER_FLAG_HOST_REQUIRED" in [...]
This commit is contained in:
+1
-1
@@ -22,7 +22,7 @@ Safer:
|
||||
|
||||
```php
|
||||
function is_allowed_url($url, $allowed_url_schemes = ['http', 'https']) {
|
||||
$valid_url = filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED) !== false;
|
||||
$valid_url = filter_var($url, FILTER_VALIDATE_URL) !== false;
|
||||
if ($valid_url) {
|
||||
$scheme = parse_url($url, PHP_URL_SCHEME);
|
||||
return in_array($scheme, $allowed_url_schemes, true);
|
||||
|
||||
Reference in New Issue
Block a user