php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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
Description:
------------
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:
----------------
/^something$/

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

Patches

Pull Requests

History

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$/')));

c.f. http://us.php.net/manual/en/function.filter-var.php
 [2012-03-08 00:17 UTC] tomp at tomp dot co dot uk
Hi,

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.

Whoops!
 [2012-03-08 02:47 UTC] iliaa@php.net
.
 [2012-03-08 02:47 UTC] iliaa@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 12:01:30 2024 UTC