php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72077 Passing reference variables breaks if that variable is used in a switch.
Submitted: 2016-04-22 14:33 UTC Modified: 2016-04-22 14:40 UTC
From: robertdesarbo at gmail dot com Assigned:
Status: Closed Package: Variables related
PHP Version: 7.0.5 OS: CentOS 7
Private report: No CVE-ID: None
 [2016-04-22 14:33 UTC] 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;
        }  
    }
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-22 14:40 UTC] robertdesarbo at gmail dot com
-Status: Open +Status: Closed
 [2016-04-22 14:40 UTC] robertdesarbo at gmail dot com
Ignore this, duplicate of https://bugs.php.net/bug.php?id=71948
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Dec 16 13:01:24 2019 UTC