summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Bobrov <syragg@gmail.com>2013-04-21 14:32:02 +0700
committerDavid Soria Parra <dsp@php.net>2013-09-16 05:23:52 +0200
commit18b54a2366dd589959240f8770bbb54be819f6e7 (patch)
tree2720a49f5f2db36d70ea9784c0e3f1b8cc007775
parent8a936e8eb938965b0daaf076c109ec60141e57a7 (diff)
downloadphp-git-18b54a2366dd589959240f8770bbb54be819f6e7.tar.gz
Fix bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names)
(cherry picked from commit c149d4ee4be81ecf005eafd43ede06e70aa4c985)
-rw-r--r--ext/filter/logical_filters.c4
-rw-r--r--ext/filter/tests/bug64441.phpt11
2 files changed, 11 insertions, 4 deletions
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index 58d5870c11..c8f94a772c 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.c
@@ -484,10 +484,6 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
}
s++;
}
-
- if (*(e - 1) == '.') {
- goto bad_url;
- }
}
if (
diff --git a/ext/filter/tests/bug64441.phpt b/ext/filter/tests/bug64441.phpt
new file mode 100644
index 0000000000..149079ec05
--- /dev/null
+++ b/ext/filter/tests/bug64441.phpt
@@ -0,0 +1,11 @@
+--TEST--
+bug 64441, FILTER_VALIDATE_URL will invalidate a hostname that ended by dot
+--SKIPIF--
+<?php if (!extension_loaded("filter")) die("skip"); ?>
+--FILE--
+<?php
+var_dump(filter_var('http://example.com./', FILTER_VALIDATE_URL));
+var_dump(filter_var('http://example.com/', FILTER_VALIDATE_URL));
+--EXPECT--
+string(20) "http://example.com./"
+string(19) "http://example.com/"