ID:               50816
 Updated by:       j...@php.net
 Reported By:      spasic dot dejan at yahoo dot de
-Status:           Open
+Status:           Verified
 Bug Type:         Scripting Engine problem
-Operating System: ubuntu 9.10
+Operating System: *
-PHP Version:      5.3.1
+PHP Version:      5.3, 6
 New Comment:

Works as expected in PHP 5.2, fails with 5.3 and above.


Previous Comments:
------------------------------------------------------------------------

[2010-01-21 22:14:08] spasic dot dejan at yahoo dot de

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 this bug report at http://bugs.php.net/?id=50816&edit=1

Reply via email to