Legacy Type Error While Displaying Profile Photos

I’m using openlitespeed on AlmaLinux 8.

Running PHP 8.x

Getting 500 errors on a few routes.

This is user’s profile photo.

“/legacy/index.php?entryPoint=download&id=1_photo&type=Users”

At first I thought it was a url rewriting problem, but the error log says type error…

thrown in /usr/local/lsws/MySite/crm/public/legacy/download.php on line 267
2021-12-18 23:25:48.021633 [NOTICE] [117901] [73.76.169.230:57964:HTTP2-281#rise] [STDERR] PHP Fatal error:  Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /usr/local/lsws/MySite/crm/public/legacy/download.ph$
Stack trace:
#0 /usr/local/lsws/MySite
/crm/public/legacy/download.php(267): in_array()
#1 /usr/local/lsws/MySite/crm/public/legacy/include/MVC/Controller/SugarController.php(1010): require_once('...')
#2 /usr/local/lsws/MySite/crm/public/legacy/include/MVC/Controller/SugarController.php(465): SugarController->handleEntryPoint()
#3 /usr/local/lsws/MySite/crm/public/legacy/include/MVC/Controller/SugarController.php(361): SugarController->process()
#4 /usr/local/lsws/MySite/crm/public/legacy/include/MVC/SugarApplication.php(101): SugarController->execute()
#5 /usr/local/lsws/MySite/crm/public/legacy/index.php(52): SugarApplication->execute()
#6 {main}
  thrown in /usr/local/lsws/MySite/crm/public/legacy/download.php on line 267

That looks like SuiteCRM is having trouble getting a proper value for

$sugar_config['allowed_preview']

here: https://github.com/salesagility/SuiteCRM-Core/blob/hotfix/public/legacy/download.php#L267

so maybe you should look in your config.php and config_override.php for issues.