Skip to content

Commit 18b54a2

Browse files
Syradsp
authored andcommitted
Fix bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names)
(cherry picked from commit c149d4ee4be81ecf005eafd43ede06e70aa4c985)
1 parent 8a936e8 commit 18b54a2

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

ext/filter/logical_filters.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,6 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
484484
}
485485
s++;
486486
}
487-
488-
if (*(e - 1) == '.') {
489-
goto bad_url;
490-
}
491487
}
492488

493489
if (

ext/filter/tests/bug64441.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
bug 64441, FILTER_VALIDATE_URL will invalidate a hostname that ended by dot
3+
--SKIPIF--
4+
<?php if (!extension_loaded("filter")) die("skip"); ?>
5+
--FILE--
6+
<?php
7+
var_dump(filter_var('http://example.com./', FILTER_VALIDATE_URL));
8+
var_dump(filter_var('http://example.com/', FILTER_VALIDATE_URL));
9+
--EXPECT--
10+
string(20) "http://example.com./"
11+
string(19) "http://example.com/"

0 commit comments

Comments
 (0)