com php-src: Fix bug #64441 (FILTER_VALIDATE_URL reject s fully qualified domain names): ext/filter/logic al_filters.c ext/filter/tests/bug64441.phpt
| From: | David Soria Parra | Date: | Mon, 16 Sep 2013 03:23:52 +0000 |
| Subject: | com php-src: Fix bug #64441 (FILTER_VALIDATE_URL reject s fully qualified domain names): ext/filter/logic al_filters.c ext/filter/tests/bug64441.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73208@lists.php.net to get a copy of this message | ||
Commit: 18b54a2366dd589959240f8770bbb54be819f6e7
Author: Alex Bobrov <syragg@gmail.com> Sun, 21 Apr 2013 14:32:02 +0700
Committer: David Soria Parra <dsp@php.net> Mon, 16 Sep 2013 05:23:52 +0200
Parents: 8a936e8eb938965b0daaf076c109ec60141e57a7
Branches: PHP-5.4 PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=18b54a2366dd589959240f8770bbb54be819f6e7
Log:
Fix bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names)
(cherry picked from commit c149d4ee4be81ecf005eafd43ede06e70aa4c985)
Bugs:
https://bugs.php.net/64441
Changed paths:
M ext/filter/logical_filters.c
A ext/filter/tests/bug64441.phpt
Diff:
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index 58d5870..c8f94a7 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 0000000..149079e
--- /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/"