|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76366 References in sub-array for filtering breaks the filter
Submitted: 2018-05-22 14:03 UTC Modified: 2018-05-23 10:05 UTC
From: dirk dot gerigk at atraveo dot com Assigned:
Status: Closed Package: Filter related
PHP Version: 7.0Git-2018-05-22 (snap) OS: Ubuntu
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: dirk dot gerigk at atraveo dot com
New email:
PHP Version: OS:


 [2018-05-22 14:03 UTC] dirk dot gerigk at atraveo dot com
When using an array for filter variables and one sub-array is (or has) an reference the filter will not filter. 
This happens in all versions PHP >= 7. In PHP 5.6 it works correct.
It takes me a long time to figure out, that the reference in the array produces the wrong behavior. If you var_dump $args before using it all seems fine.

Test script:
#array to filter
$data = ['foo' => 6];
#filter args
$args = ['foo'=> ['filter' => FILTER_VALIDATE_INT,'flags' => FILTER_FORCE_ARRAY]];
#create reference
$options = &$args['foo']['options'];
#set options
#show the filter result

Expected result:
Array ( [foo] => Array ( [0] => ) )

Actual result:
Array ( [foo] => Array ( [0] => 6 ) ) 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-05-23 10:05 UTC]
-Status: Open +Status: Verified
 [2018-05-23 10:06 UTC]
Confirmed: <>
 [2018-07-07 10:08 UTC]
Automatic comment on behalf of
Log: Fixed bug #76366 (references in sub-array for filtering breaks the filter)
 [2018-07-07 10:08 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 20 18:01:29 2024 UTC