Bug #72508 [Opn->Csd]: strange references after recursive function call and "switch" statement

From: Date: Tue, 28 Jun 2016 07:37:10 +0000
Subject: Bug #72508 [Opn->Csd]: strange references after recursive function call and "switch" statement
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201880@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72508&edit=1 ID: 72508 Updated by: laruence@php.net Reported by: aleksander dot vladishev at zabbix dot com Summary: strange references after recursive function call and "switch" statement -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: ubuntu-16.04-server-amd64 PHP Version: 7.0.8 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=ce7e180a04009e821c87e7ae2b704294a2a97c03 Log: Fixed bug #72508 (strange references after recursive function call and &quot;switch&quot; statement) Previous Comments: ------------------------------------------------------------------------ [2016-06-28 05:58:58] aleksander dot vladishev at zabbix dot com 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" } } } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72508&edit=1

« previous php.bugs (#201880) next »