Edit report at http://bugs.php.net/bug.php?id=51192&edit=1
ID: 51192
Comment by: lupo at e-noise dot com
Reported by: solar at azrael dot ws
Summary: FILTER_VALIDATE_URL will invalidate a hostname that
includes '-'
Status: Closed
Type: Bug
Package: Filter related
Operating System: linux
PHP Version: 5.2.13
Assigned To: aharvey
New Comment:
I am experiencing the same behavior with PHP 5.3.2 on Mac OSX. When
hostname contains hyphens filter_var() won't validate using the
FILTER_VALIDATE_URL filter.
The test code posted by "solar at azrael dot ws" produces the following
output:
string(18) "http://example.com"
bool(false)
string(19) "http://exa_mple.com"
Previous Comments:
------------------------------------------------------------------------
[2010-03-03 10:26:58] [email protected]
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2010-03-03 10:25:52] [email protected]
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=295773
Log: Fix for bug #51192 (FILTER_VALIDATE_URL will invalidate a hostname
that includes '-'). Original patch by [email protected].
------------------------------------------------------------------------
[2010-03-03 09:50:24] [email protected]
Yeah, that doesn't quite look right. :)
Cheers for the patch; I'll cook up a test script to go with it and
commit it.
------------------------------------------------------------------------
[2010-03-03 09:41:07] solar at azrael dot ws
Changes summary. That was too long.
------------------------------------------------------------------------
[2010-03-03 08:56:18] solar at azrael dot ws
Oops.
Test script:
var_dump(filter_var('http://example.com', FILTER_VALIDATE_URL));
var_dump(filter_var('http://exa-mple.com', FILTER_VALIDATE_URL));
var_dump(filter_var('http://exa_mple.com', FILTER_VALIDATE_URL));
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=51192
--
Edit this bug report at http://bugs.php.net/bug.php?id=51192&edit=1