One may expect SplDoublyLinkedList::shift to properly maintain internal pointers, but this is not the case, this will yield no results, even if you rewind first<?phpwhile ($splDoublyLinkedList->valid()) { yield $splDoublyLinkedList->shift();}?>It could be by design, but the following raises some more questions :<?php$test = new \SplDoublyLinkedList;$dataSet = [ ['id' => 1], ['id' => 2], ['id' => 3], ['id' => 4],];foreach ($dataSet as $row) { $test->push($row);}echo "count: " . $test->count() . PHP_EOL;echo "valid: " . ($test->valid() ? 'true' : 'false') . PHP_EOL;echo "current: " . var_export($test->current(), true) . PHP_EOL;echo "key: " . $test->key() . PHP_EOL;echo "1st shift: " . var_export($test->shift(), true) . PHP_EOL;echo "count: " . $test->count() . PHP_EOL;echo "valid: " . ($test->valid() ? 'true' : 'false') . PHP_EOL;echo "current: " . var_export($test->current(), true) . PHP_EOL;echo "key: " . $test->key() . PHP_EOL;echo "2nd shift: " . var_export($test->shift(), true) . PHP_EOL;echo "count: " . $test->count() . PHP_EOL;echo "valid: " . ($test->valid() ? 'true' : 'false') . PHP_EOL;echo "current: " . var_export($test->current(), true) . PHP_EOL;echo "key: " . $test->key() . PHP_EOL;echo "rewinding... " . PHP_EOL;$test->rewind();echo "current: " . var_export($test->current(), true) . PHP_EOL;echo "2nd shift: " . var_export($test->shift(), true) . PHP_EOL;echo "count: " . $test->count() . PHP_EOL;echo "valid: " . ($test->valid() ? 'true' : 'false') . PHP_EOL;echo "current: " . var_export($test->current(), true) . PHP_EOL;echo "key: " . $test->key() . PHP_EOL;?>will result in :<?php?>Conclusion : I may be missing something about why SplDoublyLinkedList::shift is not maintaining proper internal index in the first place, but I find it even more confusing to be able to end up with a valid valid() and a valid key() and no current() while there is obviously one.Tested on php 5.6.30 & 7.1.2 with the exact same result.