Bug #76366 [NEW]: References in sub-array for filtering breaks the filter

From: Date: Tue, 22 May 2018 14:03:53 +0000
Subject: Bug #76366 [NEW]: References in sub-array for filtering breaks the filter
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215332@lists.php.net to get a copy of this message
From: dirk dot gerigk at atraveo dot com Operating system: Ubuntu PHP version: 7.0Git-2018-05-22 (snap) Package: Filter related Bug Type: Bug Bug description:References in sub-array for filtering breaks the filter Description: ------------ 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]]; $args['foo']['options']=[]; #create reference $options = &$args['foo']['options']; #set options $options['min_range']=1; $options['max_range']=5; #show the filter result print_r(filter_var_array($data,$args)); Expected result: ---------------- Array ( [foo] => Array ( [0] => ) ) Actual result: -------------- Array ( [foo] => Array ( [0] => 6 ) ) -- Edit bug report at https://bugs.php.net/bug.php?id=76366&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76366&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76366&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76366&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76366&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76366&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76366&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76366&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76366&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76366&r=support Expected behavior: https://bugs.php.net/fix.php?id=76366&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76366&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76366&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76366&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76366&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76366&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76366&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76366&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76366&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76366&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76366&r=mysqlcfg

« previous php.bugs (#215332) next »