Bug->Doc #76265 [Opn->Ver]: The order of the same priority is not maintained
| From: | cmb@php.net | Date: | Sat, 16 Jun 2018 15:32:41 +0000 |
| Subject: | Bug->Doc #76265 [Opn->Ver]: The order of the same priority is not maintained | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-15773@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76265&edit=1
ID: 76265
Updated by: cmb@php.net
Reported by: admin at yurunsoft dot com
-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
Package: SPL related
Operating System: Linux
PHP Version: 7.0.29
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2018-04-25 23:24:53] cmb@php.net
Related to request #60926.
------------------------------------------------------------------------
[2018-04-25 10:11:10] 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)
}
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76265&edit=1