|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61323 regexp option missing for filter_var function
Submitted: 2012-03-07 22:33 UTC Modified: 2012-03-08 02:47 UTC
From: tomp at tomp dot co dot uk Assigned:
Status: Not a bug Package: Filter related
PHP Version: 5.4.0 OS: Centos 5.7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: tomp at tomp dot co dot uk
New email:
PHP Version: OS:


 [2012-03-07 22:33 UTC] tomp at tomp dot co dot uk
The regexp option is missing when using filter_var function in PHP 5.4, but was present using the same SPEC file build process when using PHP 5.3.

Test script:
$var = filter_var('/^something$/', FILTER_VALIDATE_REGEXP);

Expected result:

Actual result:
Warning: filter_var(): 'regexp' option missing in php shell code on line 1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-08 00:10 UTC] me at ktamura dot com
This is not a bug. Your function invocation is incorrect. I believe what you meant is

$var = filter_var($string_to_filter, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/^something$/')));

 [2012-03-08 00:17 UTC] tomp at tomp dot co dot uk

Thanks for this, I basically completely misunderstood what this function was supposed to do. I thought it validated a regex string (i.e was it a valid regex), not that it validated an input string matched a particular regex.

 [2012-03-08 02:47 UTC]
 [2012-03-08 02:47 UTC]
-Status: Open +Status: Not a bug
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Sep 30 23:01:24 2023 UTC