Req #73125 [NEW]: array declaration shouldn't allow same key multiple times

From: Date: Tue, 20 Sep 2016 11:20:07 +0000
Subject: Req #73125 [NEW]: array declaration shouldn't allow same key multiple times
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204147@lists.php.net to get a copy of this message
From: sami dot vento at codeworks dot fi Operating system: PHP version: 7.0.11 Package: Arrays related Bug Type: Feature/Change Request Bug description:array declaration shouldn't allow same key multiple times 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 bug report at https://bugs.php.net/bug.php?id=73125&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73125&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73125&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73125&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73125&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73125&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73125&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73125&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73125&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73125&r=support Expected behavior: https://bugs.php.net/fix.php?id=73125&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73125&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73125&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73125&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73125&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73125&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73125&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73125&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73125&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73125&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73125&r=mysqlcfg

« previous php.bugs (#204147) next »