Jump to content

Markup cache: Notice: Object of class ProcessWire\Selectors could not be converted to int


Recommended Posts

Posted

I get this notice when using markup cache

Quote

Notice: Object of class ProcessWire\Selectors could not be converted to int in /usr/local/www/apache24/noexec//online/example/dev/wire/core/PagesLoader.php on line 534

It is more or less the same from https://modules.processwire.com/modules/markup-cache/

$cache = $modules->get("MarkupCache");

if (!$data = $cache->get("tablerows__pageid_" . $page->id)) {
	$data = '';

	foreach ($page->children('limit=499') as $child):
		$data .= '<tr>';
		$data .= '<td>';
		$data .= implode(" | ", $child->title);
		$data .= '</td>';
		$data .= '</tr>';
	endforeach;

	$cache->save($data);
}

// output cached table rows
echo $data;

Is there anything wrong or has something changed? Do I need to check if the cache file exists?

Posted

A couple of things that might be relevant to the problem:

4 hours ago, suntrop said:

$cache = $modules->get("MarkupCache");

1. $cache is an API variable (WireCache) - better not overwrite it with something else.

2. WireCache provides everything that the MarkupCache module does plus more. Maybe consider using WireCache instead.

Posted

Thanks, didn't know WireCache before. I googled for cache and top results were all markup cache.

The Notice however was the same, but it turned our, it came from 

$page->children('limit=499')

When I remove the limit there is no notice. Luckily I don't need that limit :-)

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.
×
×
  • Create New...