Bug #80699 [NEW]: array_map no longer passes by reference
| From: | donatj at gmail dot com | Date: | Tue, 02 Feb 2021 19:24:50 +0000 |
| Subject: | Bug #80699 [NEW]: array_map no longer passes by reference | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-231894@lists.php.net to get a copy of this message | ||
From: donatj at gmail dot com
Operating system: All
PHP version: 8.0.1
Package: Scripting Engine problem
Bug Type: Bug
Bug description:array_map no longer passes by reference
Description:
------------
array_map no longer passes by-reference.
This has broken a lot of things for us.
This very well may be an intentional change, but I didn't see it noted,
and if it is, it should be documented on the array_map page as a change?
Test script:
---------------
<?php
// https://3v4l.org/BdWq7
$data = array(
array(1,2,3),
array(4,5,6),
);
$data = array_map('reset', $data);
print_r($data);
Expected result:
----------------
Array
(
[0] => 1
[1] => 4
)
Actual result:
--------------
Warning: reset(): Argument #1 ($array) must be passed by reference,
value given in /in/BdWq7 on line 8
Warning: reset(): Argument #1 ($array) must be passed by reference,
value given in /in/BdWq7 on line 8
Array
(
[0] => 1
[1] => 4
)
--
Edit bug report at https://bugs.php.net/bug.php?id=80699&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80699&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80699&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80699&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80699&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80699&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80699&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80699&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80699&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80699&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80699&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80699&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80699&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80699&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80699&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80699&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80699&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80699&r=mysqlcfg