Bug #69299 [NEW]: Regression in array_filter's $flag argument in PHP 7

From: Date: Wed, 25 Mar 2015 14:41:17 +0000
Subject: Bug #69299 [NEW]: Regression in array_filter's $flag argument in PHP 7
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191598@lists.php.net to get a copy of this message
From: weierophinney Operating system: Linux PHP version: master-Git-2015-03-25 (Git) Package: Arrays related Bug Type: Bug Bug description:Regression in array_filter's $flag argument in PHP 7 Description: ------------ PHP 5.6.0 added a third argument to array_filter, $flag, which can accept one of the integer constants ARRAY_FILTER_USE_KEY or ARRAY_FILTER_USE_BOTH. When the former is specified, the key is passed as the sole argument to the callback; when the latter is specified, the value and the key, in that order, are passed to the callback. Under the current master branch, the $flag is ignored. Test script: --------------- $toFilter = array('foo' => 'bar', 'fiz' => 'buz'); $filtered = array_filter($toFilter, function ($value, $key) { if ($value === 'buz' || $key === 'foo' ) { return false; } return true; }, ARRAY_FILTER_USER_BOTH); var_export($filtered); Expected result: ---------------- array() Actual result: -------------- Missing argument 2 for {closure}() -- Edit bug report at https://bugs.php.net/bug.php?id=69299&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69299&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69299&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69299&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69299&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69299&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69299&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69299&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69299&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69299&r=support Expected behavior: https://bugs.php.net/fix.php?id=69299&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69299&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69299&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69299&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69299&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69299&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69299&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69299&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69299&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69299&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69299&r=mysqlcfg

« previous php.bugs (#191598) next »