php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #76265 The order of the same priority is not maintained
Submitted: 2018-04-25 10:11 UTC Modified: 2018-06-16 15:42 UTC
From: admin at yurunsoft dot com Assigned: cmb (profile)
Status: Closed Package: SPL related
PHP Version: 7.0.29 OS: Linux
Private report: No CVE-ID: None
 [2018-04-25 10:11 UTC] admin at yurunsoft dot com
Description:
------------
The order of the same priority is disordered

Test script:
---------------
$l = new \SplPriorityQueue;
$l->insert('e', 1);
$l->insert('a', 0);
$l->insert('b', 0);
$l->insert('c', 0);
$l->insert('d', 100);
var_dump($l);

Expected result:
----------------
d
e
a
b
c

Actual result:
--------------
object(SplPriorityQueue)#4 (3) {              
  ["flags":"SplPriorityQueue":private]=>      
  int(1)                                      
  ["isCorrupted":"SplPriorityQueue":private]=>
  bool(false)                                 
  ["heap":"SplPriorityQueue":private]=>       
  array(5) {                                  
    [0]=>                                     
    array(2) {                                
      ["data"]=>                              
      string(1) "d"                           
      ["priority"]=>                          
      int(100)                                
    }                                         
    [1]=>                                     
    array(2) {                                
      ["data"]=>                              
      string(1) "e"                           
      ["priority"]=>                          
      int(1)                                  
    }                                         
    [2]=>                                     
    array(2) {                                
      ["data"]=>                              
      string(1) "b"                           
      ["priority"]=>                          
      int(0)                                  
    }                                         
    [3]=>                                     
    array(2) {                                
      ["data"]=>                              
      string(1) "c"                           
      ["priority"]=>                          
      int(0)                                  
    }                                         
    [4]=>                                     
    array(2) {                                
      ["data"]=>                              
      string(1) "a"                           
      ["priority"]=>                          
      int(0)                                  
    }                                         
  }                                           
}                                             

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-25 23:03 UTC] cmb@php.net
-Package: SPL_Types +Package: SPL related
 [2018-04-25 23:24 UTC] cmb@php.net
Related to request #60926.
 [2018-06-16 15:32 UTC] cmb@php.net
-Summary: The order of the same priority is disordered +Summary: The order of the same priority is not maintained -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: cmb
 [2018-06-16 15:32 UTC] cmb@php.net
To clarify: this is not bug, but rather a deliberate design
decision for performance reasons.  Since there is already a
respective feature request (<https://bugs.php.net/60926>), I'm
changing this ticket to doc problem.
 [2018-06-16 15:40 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=345154
Log: Fix #76265: The order of the same priority is not maintained
 [2018-06-16 15:42 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2018-06-16 15:42 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-02-07 06:05 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=6e2faf8ef3612f66ae2e90122a45feed729417ae
Log: Fix #76265: The order of the same priority is not maintained
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Sep 27 21:01:25 2020 UTC