|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80699 array_map no longer passes by reference
Submitted: 2021-02-02 19:24 UTC Modified: 2021-02-02 19:45 UTC
Avg. Score:4.0 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: donatj at gmail dot com Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 8.0.1 OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
34 - 13 = ?
Subscribe to this entry?

 [2021-02-02 19:24 UTC] donatj at gmail dot com
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:


$data = array(

$data = array_map('reset', $data);


Expected result:
    [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
    [0] => 1
    [1] => 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-02 19:45 UTC]
-Type: Bug +Type: Documentation Problem
 [2021-02-02 19:45 UTC]
Yes, that's an intentional change; if you need a reference, there is array_walk for that.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 26 14:03:36 2021 UTC