Bug #79237 [Asn->Ver]: filter_var limited to 8192 characters in input string

From: Date: Fri, 07 Feb 2020 10:43:24 +0000
Subject: Bug #79237 [Asn->Ver]: filter_var limited to 8192 characters in input string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225421@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79237&edit=1

 ID:                 79237
 Updated by:         cmb@php.net
 Reported by:        murray at focus-computing dot com dot au
 Summary:            filter_var limited to 8192 characters in input
                     string
-Status:             Assigned
+Status:             Verified
 Type:               Bug
 Package:            *Regular Expressions
 Operating System:   Debian 4.19.67-2+deb10u1 (2019-0
 PHP Version:        7.3Git-2020-02-07 (Git)
-Assigned To:        cmb
+Assigned To:        
 Block user comment: N
 Private report:     N

 New Comment:

Thanks for the confirmation.

It seems to me there should be some hint available why that regex
match failed; maybe just set the last PCRE error, so a user can
get information by calling preg_last_error() (what could be
regarded as BC break, though).


Previous Comments:
------------------------------------------------------------------------
[2020-02-07 09:41:57] murray at focus-computing dot com dot au

I tried pcre.jit=0 and this worked.
I'm not sure what that changes, or why it worked.  I'm happy, but perhaps we should add a
comment to the online manual?

------------------------------------------------------------------------
[2020-02-07 08:03:54] cmb@php.net

Please try again with pcre.jit=0 (unless you did already).  With
pcre.jit=1, I get PCRE2_ERROR_JIT_STACKLIMIT[1] internally.

[1] <https://www.pcre.org/current/doc/html/pcre2api.html#SEC31>

------------------------------------------------------------------------
[2020-02-07 03:29:54] murray at focus-computing dot com dot au

Description:
------------
I was testing some input being passed via a parameter to my script.  I was getting an error
indicating that the value passed was invalid, yet it didn't contain any of the strings I was
searching for.  
I went through the process of shortening the string and when I got below 8192 chars in length it
worked, over 8192 chars in length it would fail.

I also tried this on PHP v7.1.32 and the exact same code on my Mac OSX which worked correctly.

Test script:
---------------
filter_var(trim($_REQUEST['parms']), FILTER_VALIDATE_REGEXP, array("options"
=> array("regexp" => "/^((?!union select|union all|\'A=|select
char).)*$/im")));

Expected result:
----------------
A) filter_var should handle strings longer than 8192 chars

OR

B) Add documentation to filter_var manual entry indicating maximum length of string.



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



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


Thread (4 messages)

« previous php.bugs (#225421) next »