Bug #61323 [Com]: regexp option missing for filter_var function
| From: | tomp at tomp dot co dot uk | Date: | Thu, 08 Mar 2012 00:17:59 +0000 |
| Subject: | Bug #61323 [Com]: regexp option missing for filter_var function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-168253@lists.php.net to get a copy of this message | ||
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