Bug #72077 [Opn->Csd]: Passing reference variables breaks if that variable is used in a switch.

From: Date: Fri, 22 Apr 2016 14:40:54 +0000
Subject: Bug #72077 [Opn->Csd]: Passing reference variables breaks if that variable is used in a switch.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200689@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72077&edit=1 ID: 72077 User updated by: robertdesarbo at gmail dot com Reported by: robertdesarbo at gmail dot com Summary: Passing reference variables breaks if that variable is used in a switch. -Status: Open +Status: Closed Type: Bug Package: Variables related Operating System: CentOS 7 PHP Version: 7.0.5 Block user comment: N Private report: N New Comment: Ignore this, duplicate of https://bugs.php.net/bug.php?id=71948 Previous Comments: ------------------------------------------------------------------------ [2016-04-22 14:33:10] robertdesarbo at gmail dot com Description: ------------ If you pass a variable as a reference to a function and use that variable in a switch then the variable will not update outside the function. This worked in 7.0.4 but is not working in 7.0.5. Test script: --------------- $var = 'WHAT_IS_THIS'; class BROKEN_VARIABLE_REF { public function __construct() {} public function do_it( &$data ) { switch($data) { case 'WHAT_IS_THIS': $data = "I_WORK"; break; default: $retFlag = false; break; } } } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72077&edit=1

« previous php.bugs (#200689) next »