Skip to content

References as key in Ds\Map() not work #86

@botanegg

Description

@botanegg

Hi!
I newbie in php, and i have a problem with Ds\Map()
If I use a reference as a key or I use variable with a reference as a key Ds\Map cannot found my value.

Reproduce code:

<?php
$map = new Ds\Map();
$str = "test_key";
$str_ref = &$str; // comment uncomment this
$map[$str] = "stored"; // try $str_ref too
if ($map->hasKey($str)) { // try $str_ref too
    echo "found";
} else {
    echo "not found";
}

Version info:

Linux home-desktop 4.10.13-1-ARCH #1 SMP PREEMPT Thu Apr 27 12:15:09 CEST 2017 x86_64 GNU/Linux
PHP 7.1.5 (cli) (built: May  9 2017 16:55:02) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Xdebug v2.5.3, Copyright (c) 2002-2017, by Derick Rethans

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions