|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51632 filter_var fails to validate correct URL
Submitted: 2010-04-22 11:52 UTC Modified: 2010-04-23 04:50 UTC
From: zharkikh at i dot com dot ua Assigned:
Status: Duplicate Package: Unknown/Other Function
PHP Version: 5.3.2 OS: FreeBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: zharkikh at i dot com dot ua
New email:
PHP Version: OS:


 [2010-04-22 11:52 UTC] zharkikh at i dot com dot ua
Function filter_var seems to change it behavior when PHP upgraded from 5.2.4 to 5.3.2.
The next example work fine in 5.24 but fail in 5.3.2.
This problem was described in Bug #51305 (filter_var fails if domain name contain "-") and reported to be fixed in 5.2.13, but it is bubble again in 5.3.2 :

Test script:
$P = '';

Expected result:
----------------, so URL is valid

Actual result:
false, so URL provided evaluated as invalid


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-22 12:44 UTC]
-Status: Open +Status: Feedback
 [2010-04-22 12:45 UTC]
Please try using this snapshot:
For Windows:

PHP 5.3.2 was released on March 4, and the #51305 was fixed on March 3. It probably didn't make it into the release. It works for me on 5.3.3-dev built a few days ago.
 [2010-04-22 21:48 UTC]
This was fixed in svn a while ago.
 [2010-04-23 04:50 UTC]
-Status: Feedback +Status: Duplicate
 [2010-04-23 04:50 UTC]
To confirm, this didn't make 5.3.2. It should be in 5.3.3.

Closing duplicate: the original bug is bug #51192.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Sep 28 19:05:53 2022 UTC