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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 08:01:28 2024 UTC