Bug #71660 [Opn->Csd]: array_column behaves incorrectly after foreach by reference
Edit report at https://bugs.php.net/bug.php?id=71660&edit=1
ID: 71660
Updated by: laruence@php.net
Reported by: icarpenter at leadid dot com
Summary: array_column behaves incorrectly after foreach by
reference
-Status: Open
+Status: Closed
Type: Bug
Package: Arrays related
PHP Version: 7.0.3
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c299b272c77b9bea4d6371a37a6d2b894f9729e8
Log: Fixed bug #71660 (array_column behaves incorrectly after foreach by reference)
Previous Comments:
------------------------------------------------------------------------
[2016-02-25 00:12:36] icarpenter at leadid dot com
Description:
------------
If you do a foreach by reference on an array, array_column will ignore the third parameter
Test script:
---------------
<?php
$arr = array('id' => 12345, 'name' => 'sam');
foreach ($arr as &$v) {
$v = $v;
}
$arr = [$arr];
var_dump(array_column($arr, 'name', 'id'));
Expected result:
----------------
array(1) {
[12345]=>
string(3) "sam"
}
Actual result:
--------------
array(1) {
[0]=>
&string(3) "sam"
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71660&edit=1
Thread (2 messages)