salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.26k stars 2.03k forks source link

Fix #10450 - Add check for empty value before searching array #10451

Open JackBuchanan opened 2 weeks ago

JackBuchanan commented 2 weeks ago

Add empty check to avoid 500 error when deploying module from module loader

Description

Add empty check after loading user preferences to avoid 500 when running php8+

PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument https://github.com/salesagility/SuiteCRM/issues/2 ($array) must be of type array, null given

Motivation and Context

Fixes potential 500 error when deploying module from module loader if user has no global search preference set

How To Test This

  1. Reset User Preferences
  2. Avoid using functionality that will set global search user preferences e.g. global search
  3. Attempt to deploy module changes from module loader
  4. See 500 error in logs and module deploy fail to complete

Types of changes

Final checklist