From:             spasic dot dejan at yahoo dot de
Operating system: ubuntu 9.10
PHP version:      5.3.1
PHP Bug Type:     Arrays related
Bug description:  field are not overridden by same index in a assingment

Description:
------------
Some lines of code is worth a thousand words

Reproduce code:
---------------
class Foo {
  const ONE = 1;
  const TWO = 1;

  public static $mapWithConst = array(self::ONE => 'one', self::TWO =>
'two',);

  public static $mapWithoutConst = array(17 => 'one', 17 => 'two',);
}

$mapWithConst = array(1 => 'one', 1 => 'two',);

$mapWithoutConst = array(Foo::ONE => 'one', Foo::TWO => 'two',);

var_dump(Foo::$mapWithConst);
var_dump(Foo::$mapWithoutConst);
var_dump($mapWithConst);
var_dump($mapWithoutConst);


Expected result:
----------------
array(1) {
  [1]=>
  string(3) "two"
}
array(1) {
  [17]=>
  string(3) "two"
}
array(1) {
  [1]=>
  string(3) "two"
}
array(1) {
  [1]=>
  string(3) "two"
}


Actual result:
--------------
array(1) {
  [1]=>
  string(3) "one"   // ???
}
array(1) {
  [17]=>
  string(3) "two"
}
array(1) {
  [1]=>
  string(3) "two"
}
array(1) {
  [1]=>
  string(3) "two"
}


-- 
Edit bug report at http://bugs.php.net/?id=50816&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=50816&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=50816&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=50816&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=50816&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=50816&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=50816&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=50816&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=50816&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=50816&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=50816&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=50816&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=50816&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=50816&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=50816&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50816&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50816&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=50816&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=50816&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=50816&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=50816&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=50816&r=mysqlcfg

Reply via email to