Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
botanegg opened this issue May 11, 2017 · 1 comment
Closed

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

botanegg opened this issue May 11, 2017 · 1 comment

Comments

@botanegg
Copy link

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
@rtheunissen
Copy link
Member

This was only an issue when using array access syntax. Fixed in cc6527e and released as v1.1.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants