Edit report at https://bugs.php.net/bug.php?id=61323&edit=1

 ID:                 61323
 Comment by:         tomp at tomp dot co dot uk
 Reported by:        tomp at tomp dot co dot uk
 Summary:            regexp option missing for filter_var function
 Status:             Open
 Type:               Bug
 Package:            Filter related
 Operating System:   Centos 5.7
 PHP Version:        5.4.0
 Block user comment: N
 Private report:     N

 New Comment:

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!


Previous Comments:
------------------------------------------------------------------------
[2012-03-08 00:10:46] 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-07 22:33:24] 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


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61323&edit=1

Reply via email to