Archivist 500 error

Hi All!

I have a blog which i created using collections/tagger/archivist.
It has been up and running for many years, and not a problem, but today a user mentioned that the archives section isn’t working, and throws 500 errors whenever they click on a year.

I haven[t’ changed anything, so all i can think is that an update somewhere down the line killed it.

This is what I have to create the links to the years:

`        [[!Archivist? &target=`135` &parents=`137` &useMonth=`0` &tpl=`archiveLinkCollectionsTpl`]]

The target resource (135) contains this:

   ` [[!getPage?


But when a user clicks on the year of 2019 for example, it goes to: and throws a 500 error.

Any ideas what could be causing this?
I’ve reviewed my code in the docs and cannot see any issues.

Thanks in advance!

UPDATE: I just worked out that it’s the PHP version which is causing the problem!
I recently updated the site to run on PHP7.2.
I just changed it back to PHP7.0 =, and the archives work.

Any ideas why?
Or more importantly how to fix it?


Are you getting any errors in the MODX log?

Thanks - just checked and it says this:
[2019-10-16 14:51:25] (ERROR @ /home/site/public_html/core/cache/includes/elements/modsnippet/67.include.cache.php : 142) PHP warning: count(): Parameter must be an array or an object that implements Countable

At this line:

you could try to add:

if (!$resources){
    return '';

Thanks Bruno - but unfortunately that didn’t work. :frowning:

might be an MODX - issue then and the object returned by getIterator doesn’t implement Countable.

did you try, just to set the debug - system-setting to 0?

OK thanks Bruno - I hadn’t tried that - the setting was blank, but I just added a zero in there - and no change unfortunately. :frowning:

I just found this in the Archivist Bug reporting, which sounds like the same problem as mine:

After making the code change Bruno suggested, did the error message change? Or still the same one?

Hmm - strangely there is no error in the logs with that added code - but I still get a 500 error for the archive pages e.g.:

Most likely something here, though it may be very difficult to find.

Thank Bob

That’s all a bit beyond my knowledge base I’m afraid.
Fingers crossed the developer comes back with an upgrade/fix because I’ve had to upgrade php to 7.2 due to other extras making it a minimum requirement.

Hi all. I have another site which runs a blog using Articles.

This still uses archivist to create the archive pages - but that works fine, and it’s on php 7.2. and MODX 2.7.2. So I suppose a work around is to recreate the blog using Articles, instead of getResources/Collections. I just cannot work out why it would be different, as they both use the same Extra (Archives).

The .htaccess file is the most common cause of 500 errors. There’s one in the root and sometimes one in the Manager folder. Have you changed either one lately?

Do you have the latest version of MODX?

It sounds like you’ve eliminated most of the possible causes on your end, at that point, it’s most likely something your host did, like a PHP upgrade, change in the file structure, new php.ini, or new mod_security rules. It’s also possible that the database is overloaded and is timing out or rejecting calls from the Manager.

Hi. The htaccess file haven’t changed. All other pages work fine - it’s just the archives. I’m running the latest version of MODX.

~The problem is definitely linked to the PHP version - which I upgraded. It works on php V7, but not PHP v7.2,

Does it help replacing count by iterator_count on this line?

Thanks for this - but I just managed to solve it - from a previous post i just found:

Basically on line 60 of the snippet getArchives it says to change:

$where[] = 'FROM_UNIXTIME(`'.$filterField.'`,"%Y") = "'.$year.'"';


$where =[];
$where[] = 'FROM_UNIXTIME(`'.$filterField.'`,"%Y") = "'.$year.'"';

All working fine now!
Only problem is if there is a future update of the snippet, it may reverse the fix if it’s not in the update?

Thanks all - Got there in the end!!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.