Bug #79850 [NEW]: array_walk / array_filter incorrectly warn variables should be passed by ref

From: Date: Mon, 13 Jul 2020 12:21:33 +0000
Subject: Bug #79850 [NEW]: array_walk / array_filter incorrectly warn variables should be passed by ref
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227999@lists.php.net to get a copy of this message
From: sjon Operating system: archLinux PHP version: 8.0.0alpha2 Package: Arrays related Bug Type: Bug Bug description:array_walk / array_filter incorrectly warn variables should be passed by ref Description: ------------ I'm not 100% sure this is a bug but both array_walk and array filter throw warnings when variables are passed by reference. Either the message is inverted (they don't accept variables by reference) or it's incorrectly thrown Originally found as https://3v4l.org/WH94Q Test script: --------------- $ids = array("8479"); $newIds = array_filter($ids, function(&$n) { $n = intVal($n); }); Expected result: ---------------- no warning Actual result: -------------- Warning: {closure}(): Argument #1 ($n) must be passed by reference, value given in /in/WH94Q on line 7 -- Edit bug report at https://bugs.php.net/bug.php?id=79850&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79850&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79850&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79850&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79850&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79850&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79850&r=support Expected behavior: https://bugs.php.net/fix.php?id=79850&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79850&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79850&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79850&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79850&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79850&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79850&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79850&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79850&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79850&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79850&r=mysqlcfg

« previous php.bugs (#227999) next »