diff --git a/library/Zend/Stdlib/PriorityList.php b/library/Zend/Stdlib/PriorityList.php index 1664e193280..1dce67ba92a 100644 --- a/library/Zend/Stdlib/PriorityList.php +++ b/library/Zend/Stdlib/PriorityList.php @@ -54,6 +54,13 @@ class PriorityList implements Iterator, Countable */ protected $sorted = false; + /** + * Holds current node, false if current() was invalid + * + * @var mixed + */ + protected $currentNode = false; + /** * Insert a new item. * @@ -193,6 +200,7 @@ public function rewind() public function current() { $node = current($this->items); + $this->currentNode = $node; return ($node !== false ? $node['data'] : false); } @@ -227,7 +235,8 @@ public function next() */ public function valid() { - return ($this->current() !== false); + $this->current(); + return ($this->currentNode !== false); } /**