php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55325 array constant key cause un-order result
Submitted: 2011-07-30 15:33 UTC Modified: 2011-07-30 15:53 UTC
From: laruence@php.net Assigned:
Status: Duplicate Package: Scripting Engine problem
PHP Version: 5.3SVN-2011-07-30 (SVN) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: laruence@php.net
New email:
PHP Version: OS:

 

 [2011-07-30 15:33 UTC] laruence@php.net
Description:
------------
this is similar to #50816

but not quite same. 



Test script:
---------------
define("FIRST_KEY", "a");
define("THIRD_KEY", "c");

function test()
{
        static $arr = array(
                "a" => "222",
                FIRST_KEY => "111",
                "c" => "333",
                THIRD_KEY => "444",
        );
        print_r($arr);
}

test();

Expected result:
----------------
Array
(
    [a] => 111
    [c] => 444
)

Actual result:
--------------
Array
(
    [a] => 222
    [c] => 444
)

Patches

bug55325.patch (last revision 2011-07-30 15:34 UTC) by laruence@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-30 15:34 UTC] laruence@php.net
The following patch has been added/updated:

Patch Name: bug55325.patch
Revision:   1312040074
URL:        https://bugs.php.net/patch-display.php?bug=55325&patch=bug55325.patch&revision=1312040074
 [2011-07-30 15:53 UTC] laruence@php.net
-Status: Open +Status: Duplicate
 [2011-07-30 15:53 UTC] laruence@php.net
hmm, actually it's a dup...
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC