Req #73125 [Com]: array declaration shouldn't allow same key multiple times
| From: | daniele dot maggio at dotnext dot it | Date: | Wed, 12 Dec 2018 09:26:03 +0000 |
| Subject: | Req #73125 [Com]: array declaration shouldn't allow same key multiple times | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218412@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73125&edit=1
ID: 73125
Comment by: daniele dot maggio at dotnext dot it
Reported by: sami dot vento at codeworks dot fi
Summary: array declaration shouldn't allow same key multiple
times
Status: Open
Type: Feature/Change Request
Package: Arrays related
PHP Version: 7.0.11
Block user comment: N
Private report: N
New Comment:
Sorry but I think it's not a bug;
it is correct that your value is overwrited since you use a text key, The matter is how you use
things.
Previous Comments:
------------------------------------------------------------------------
[2016-09-20 11:20:05] sami dot vento at codeworks dot fi
Description:
------------
Defining array with single clause should check duplicate keys and at least warn user. Current
implementation just takes last defined value for key.
Test script:
---------------
$a = array('a'=>3, 'a'=>4);
var_dump($a);
Expected result:
----------------
notice, warning or error
Actual result:
--------------
array(1) {
["a"]=>
int(4)
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73125&edit=1