Jump to content

$page->next returning NullPage erroneously

Mike Rockett

Recommended Posts

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?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By cryostar
      Hi all,
      I used LoginRegister for my front-end authentication and I noticed that when you type in an invalid password on the profile form, the form can still be submitted thus saving my password. Here’s my repro steps:
      1. Go to LoginRegister profile form
      2. Type in an invalid password (like ‘b’)
      3. Submit
      I have enabled to include the current password on my profile form but that didn’t perform any validation.
      Has anyone experienced this as well?
    • By cst989
      I have a file I want to access with ajax:
      The purpose of this file is to iterate through a repeater, and get the image from each entry.
      The number of images in the image field is set to 1, and just for good measure, to return a single image.
      And my code:
      // site/ajax/processImage.ajax.php?group=1206 require_once($_SERVER['DOCUMENT_ROOT'].'/index.php'); $resourceGroup = (int) $_REQUEST['group']; // get the Repeater field $resources = $pages->get($resourceGroup)->resources; foreach ($resources as $resource) { echo $resource->title; // Works as expected echo $resource->image->url; // /site/assets/files/1259/ echo $resource->image; // filename.jpg echo $resource->image->description; // nothing } See comments above for what is output, why isn't URL giving me a full URL, and no description is available?
      If I try to access $image->size() I get the following fatal error:
      Error: Uncaught exception 'ProcessWire\WireException' with message 'Method Pageimages::size does not exist or is not callable in this context' in F:\sites\<sitename>\wire\core\Wire.php:519
    • By flashmaster
      Hi im new to this forum and i need some help with a booking system that i have trying to implement under Processwire. I hope that i can explain as much as i can what my problem is.
      Here is the orginal script https://github.com/olejon/phpmyreservation
      I downloaded the script and got some help to fix it because it was all messed up. I have attached a file "ReservationSystem.rar" and it should work out of the box. Also attached the database file "Phpmyreservation.sql".
      The thing is the script works great as it is now but when i install a blank version of processwire and import the script to the template folder it wont work. I have tried many things but cant get it to work just error after error etc. Please ask me if you need some more information about this. I know you are the experts so thats why im asking you.
      Thanks everyone who responded, Dragan helped me out and got me up and running.
    • By ren
      Hi folks,
      My department is planning to move up to five of our employer's websites in-house and onto ProcessWire from a CMS which has not seen much development in the last few years. They're B2B magazine websites and we feel that ProcessWire would be a great fit. But there are concerns over support. I'm the only server side programmer, so what would happen were I to leave or be hit by the proverbial bus?
      So we're looking for some kind of insurance. Thinking along the lines of a support contract, covering maybe 2 hours of support time per month. With a commitment to become more involved should the need arise, so providing more support if needed to someone who takes over my role, or in the 'bus' type emergency, be willing to take over full support duties for a limited period of time.
      The 2 or so hours would be used for providing advice if I were to really get stuck. But I'm happy using the forums for help, and I've built a prototype of one of the sites without huge difficulty (go ProcessWire!), so under normal circumstances they probably won't be used.
      The five sites are all quite large (the prototype site has 40 templates and 95 fields), consisting of news sections, a jobs section, a business directory, reader polls and social media integration. Some of the sites allow membership for the business directory, so companies can login and manage their listing and upload press releases, via a custom dashboard (implemented as a Process module).
      All code will be commented and held in a git repo.
      We're located in the UK. Email support would be sufficient I think.
      If you're interested, please PM me with a rough estimate of costs for:
      The ~ 2 hours per month standard support. Full 'emergency' support of all 5 websites. Any one-off setup costs. And/or suggest an alternative pricing structure / proposal.
      Again at this stage we're just looking for a rough idea of costs and who would be available, so ballpark figures would be fine
      If you could also provide a link to your website please.
      Please let me know if you would like any further information.
  • Create New...