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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
5 + 25 = ?
Subscribe to this entry?

 
 [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: Fri Apr 26 14:01:29 2024 UTC