php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71999 Array references inside switch regression
Submitted: 2016-04-09 20:48 UTC Modified: 2016-04-09 23:01 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: albertcasademont at gmail dot com Assigned:
Status: Duplicate Package: Arrays related
PHP Version: 7.0.5 OS: Debian 8.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: albertcasademont at gmail dot com
New email:
PHP Version: OS:

 

 [2016-04-09 20:48 UTC] albertcasademont at gmail dot com
Description:
------------
In PHP 7.0.4 the script below worked correctly, the result was TRUE. It's not the case in PHP 7.0.5 it seems that the reference inside the switch and case statements is not working correctly.

Test script:
---------------
<?php

function bar(&$b)
{
    switch ($b) {
        case 'bar':
            $b = null;
    }
}

$a = ['foo' => 'bar'];

bar($a['foo']);

var_dump(null === $a['foo']);

Expected result:
----------------
bool(true)

Actual result:
--------------
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-09 20:50 UTC] albertcasademont at gmail dot com
You can also check it here

https://3v4l.org/5dWuf
 [2016-04-09 23:01 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 [2016-04-09 23:01 UTC] nikic@php.net
Duplicate of bug #71914. This will be fixed in PHP 7.0.6.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Fri Nov 16 02:01:26 2018 UTC