|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-06-28 07:37 UTC] laruence@php.net
[2016-06-28 07:37 UTC] laruence@php.net
-Status: Open
+Status: Closed
[2016-07-06 05:47 UTC] davey@php.net
[2016-07-20 11:30 UTC] davey@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ This regression was introduced in 7.0.x, and worked perfectly otherwise in previous versions (5.6.x). It can be reproduced with "default:" case only. Test script: --------------- <?php function check_data(&$var) { if (is_array($var)) { foreach ($var as $key => $val) { check_data($var[$key]); } } } $data = ['values' => [['type' => '4']]]; check_data($data); $values = $data['values']; foreach ($values as &$value) { switch ($value['type']) { default: $value['value'] = true; } } unset($value); echo var_dump($values)."\n".var_dump($data)."\n"; Expected result: ---------------- array(1) { [0]=> array(2) { ["type"]=> string(1) "4" ["value"]=> bool(true) } } array(1) { ["values"]=> array(1) { [0]=> array(1) { ["type"]=> string(1) "4" } } } Actual result: -------------- array(1) { [0]=> array(2) { ["type"]=> &string(1) "4" ["value"]=> bool(true) } } array(1) { ["values"]=> array(1) { [0]=> array(1) { ["type"]=> &string(1) "4" } } }