#50816 [Opn->Ver]: field are not overridden by same index in a assingment

From: Date: Fri, 22 Jan 2010 13:45:10 +0000
Subject: #50816 [Opn->Ver]: field are not overridden by same index in a assingment
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-146867@lists.php.net to get a copy of this message
ID: 50816 Updated by: jani@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

« previous php.bugs (#146867) next »