MODX 2.8.6/3.0.4 + PHP 7.4 breaks thumbnails in the manager

Summary

The version of phpThumb that comes with MODX 2.8.6 has a line of code that throws a fatal error in PHP 7.4.

(The phpThumb library is used in the MODX manager to generate the thumbnails in the media browser and the preview for image TVs.)

Step to fix the issue

To fix the issue, remove the word mixed from this line in the file core/model/phpthumb/phpthumb.class.php

Alternatively change the PHP version to at least 8.0.

Related issue on Github

Environment

MODX 2.8.6-pl
PHP 7.4

6 Likes

The same problem occurs with MODX version 3.0.4.

Step to fix the issue

In MODX 3 the file to change is core/vendor/james-heinrich/phpthumb/phpthumb.class.php
Remove the word mixed on line 317 (or change the PHP version to at least 8.0).

Environment

MODX 3.0.4-pl
PHP 7.4

4 Likes

It works!
In addition, you must remember to clear the cache and log back into the CMS.

Works for me just by clearing the browser disk cache, without logging out of MODX.

As noted by @halftrainedharry this is also broken in PHP5.x too

Thanks for this, confirming this is still an issue. Why?

I just had this “blind image” error while using PHP8.1.
After switching to 8.2 it worked.
Maybe 8.0 is not high enough to avoid this error?
Cheers, Oliver

It probably was a different issue then.

This specific problem is caused by the use of the pseudo type mixed in the code. The pseudo type mixed was introduce with PHP 8.0:

https://www.php.net/manual/en/language.types.mixed.php

1 Like

Yep, might be a different issue. But what’s funny: with 8.1 removing “mixed" worked, thumbnails were there again. Then again reinserting “mixed”, thumbnails gone. I took the rest of the day off. :smiley:

I found this as well on MODX 2.8.6 with PHP 8.3.1.

Initially I cleared the cache from the Manager, then from the terminal - images showed as broken and php errors were logged.

Logging out and back in resolved the issue.