Bug #69723 [Opn->Csd]: Passing parameters by reference and array_column

From: Date: Fri, 29 May 2015 05:53:20 +0000
Subject: Bug #69723 [Opn->Csd]: Passing parameters by reference and array_column
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192988@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69723&edit=1 ID: 69723 Updated by: laruence@php.net Reported by: j dot sarachaga at case-inc dot com Summary: Passing parameters by reference and array_column -Status: Open +Status: Closed Type: Bug Package: Arrays related Operating System: Linux\Debian PHP Version: master-Git-2015-05-28 (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=ed8d1ba7dd3f37e60fbd9520ff35986d5c946812 Log: Fixed bug #69723 (Passing parameters by reference and array_column) Previous Comments: ------------------------------------------------------------------------ [2015-05-28 20:16:53] j dot sarachaga at case-inc dot com Description: ------------ I get an unexpected behavior when passing an array by reference and after that try to use the function array_column. Test script: --------------- <?php function byReference( & $array){ foreach($array as &$item){ $item['nanana'] = 'batman'; $item['superhero'] = 'robin'; } } $array = [ [ 'superhero'=> 'superman', 'nanana' => 'no nana' ], [ 'superhero'=> 'acuaman', 'nanana' => 'no nana' ], ]; var_dump(array_column($array, 'superhero')); byReference($array); var_dump(array_column($array, 'superhero')); Expected result: ---------------- array(2) { [0]=> string(6) "batman" [1]=> string(6) "batman" } Actual result: -------------- array(0) { } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69723&edit=1

« previous php.bugs (#192988) next »