Closed dankobiaka closed 9 years ago
See https://github.com/zendframework/zf2/blob/master/library/Zend/Stdlib/PriorityList.php#L66
Zend\Stdlib\PriorityList increments $this->count every single time insert($name, $value) is called, regardless of whether $name already exists.
$this->count
insert($name, $value)
$name
This results in an incorrect count being calculated when inserting items with the same $name.
For example, to see this issue:
$list = new \Zend\Stdlib\PriorityList(); $list->insert('test', 'value'); $list->insert('test', 'value'); $list->insert('test', 'value'); print sprintf("List count: %d\n", count($list)); print sprintf("Array count: %d\n", count($list->toArray())); $list->remove('test'); print sprintf("List count after removing 1 item: %d\n", count($list)); print sprintf("Array count after removing 1 item: %d\n", count($list->toArray())); // -- outputs: -- // List count: 3 // Array count: 1 // List count after removing 1 item: 2 // Array count after removing 1 item: 0
Fixed with #9.
See https://github.com/zendframework/zf2/blob/master/library/Zend/Stdlib/PriorityList.php#L66
Zend\Stdlib\PriorityList increments
$this->count
every single timeinsert($name, $value)
is called, regardless of whether$name
already exists.This results in an incorrect count being calculated when inserting items with the same
$name
.For example, to see this issue: