Bug #69299 [Opn->Csd]: Regression in array_filter's $flag argument in PHP 7

From: Date: Wed, 25 Mar 2015 15:51:51 +0000
Subject: Bug #69299 [Opn->Csd]: Regression in array_filter's $flag argument in PHP 7
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191601@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69299&edit=1 ID: 69299 Updated by: laruence@php.net Reported by: weierophinney@php.net Summary: Regression in array_filter's $flag argument in PHP 7 -Status: Open +Status: Closed Type: Bug Package: Arrays related Operating System: Linux PHP Version: master-Git-2015-03-25 (Git) Block user comment: N Private report: N New Comment: Automatic comment on behalf of laruence Revision: http://git.php.net/?p=php-src.git;a=commit;h=d55d10c7fd7353bfc9e42e3d81bd61a87c063770 Log: Fixed bug #69299 (Regression in array_filter's $flag argument in PHP 7) Previous Comments: ------------------------------------------------------------------------ [2015-03-25 14:41:16] weierophinney@php.net 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 this bug report at https://bugs.php.net/bug.php?id=69299&edit=1

« previous php.bugs (#191601) next »