Skip to content

Commit

Permalink
Trying to fix zendframework#6768: allowing false values in PriorityList
Browse files Browse the repository at this point in the history
  • Loading branch information
Grundik committed Oct 16, 2014
1 parent 3e6936d commit e9812a0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion library/Zend/Stdlib/PriorityList.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -193,6 +200,7 @@ public function rewind()
public function current()
{
$node = current($this->items);
$this->currentNode = $node;
return ($node !== false ? $node['data'] : false);
}

Expand Down Expand Up @@ -227,7 +235,8 @@ public function next()
*/
public function valid()
{
return ($this->current() !== false);
$this->current();
return ($this->currentNode !== false);
}

/**
Expand Down

0 comments on commit e9812a0

Please sign in to comment.