I think I may have stumbled into a bug, or perhaps something has changed since 2.5.3. I have the following function that I refer to in order to obtain the latest journal entry, or the one after that if the latest is currently being viewed:
function journalLatestEntry($showNextIfCurrent = true)
{
global $wire;
$return = array(
'page' => $wire->pages->findOne('template=journal-entry, sort=-created'),
'isCurrent' => false
);
if ($showNextIfCurrent) {
if ($wire->page->id == $return['page']->id) {
$return['page'] = $return['page']->next;
$return['isCurrent'] = true;
}
}
return $return;
}
Unfortunately, since upgrading the dev-site to 2.6.0, next is returning NullPage erroneously as there are pages after the one returned. Perhaps something has changed with regards to the way in which findOne() works?