Skip to content

Commit 54130d7

Browse files
committed
fix: remove mailto,tel,sms from the default valid schemas
It seems there are few use cases.
1 parent 1b0850e commit 54130d7

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

system/Validation/FormatRules.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public function valid_url_strict(?string $str = null, ?string $validSchemes = nu
308308
$scheme = strtolower(parse_url($str, PHP_URL_SCHEME));
309309
$validSchemes = explode(
310310
',',
311-
strtolower($validSchemes ?? 'http,https,mailto,tel,sms')
311+
strtolower($validSchemes ?? 'http,https')
312312
);
313313

314314
return in_array($scheme, $validSchemes, true)

tests/system/Validation/FormatRulesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function urlProvider()
214214
[
215215
'mailto:support@codeigniter.com',
216216
true,
217-
true,
217+
false,
218218
],
219219
[
220220
'//example.com',

user_guide_src/source/libraries/validation.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -863,12 +863,11 @@ valid_ip No Fails if the supplied IP is not valid.
863863
valid_url No Fails if field does not contain (loosely) a
864864
URL. Includes simple strings that could be
865865
hostnames, like "codeigniter".
866-
valid_url_strict Yes Fails if field does not contain a valid URL. valid_url_strict[http,https]
866+
valid_url_strict Yes Fails if field does not contain a valid URL. valid_url_strict[https]
867867
Roughly equivalent to a "fail anything that
868868
would not be a clickable link." You can
869869
optionally specify a list of valid schemas.
870-
If not specified,
871-
``http,https,mailto,tel,sms`` are valid.
870+
If not specified, ``http,https`` are valid.
872871
valid_date No Fails if field does not contain a valid date. valid_date[d/m/Y]
873872
Accepts an optional parameter to matches
874873
a date format.

0 commit comments

Comments
 (0)