CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#12523] Uninstall module error. PHP8

avatar
Created By: Yuri Haperski (cmsms)
Date Submitted: Thu Jan 27 15:06:26 -0500 2022

Assigned To: Fernando Morgado (JoMorg)
Version: 2.2.16
CMSMS Version: 2.2.16
Severity: Critical
Resolution: Fixed
State: Open
Summary:
Uninstall module error. PHP8
Detailed Description:
I got an error when trying to uninstall a module:

Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type
Countable|array, null given in
/home/user/Public/cmsms/lib/classes/class.moduleoperations.inc.php:936

Replace 
if (!$list || !count($list)) return; 
with
if (!$list || !count($list)) return [];

in the file class.Alert.php, string 294


History

Comments
avatar
Date: 2022-01-27 16:34
Posted By: Philippe Thomas (filto)

/lib/classes/class.moduleoperations.inc.php

L 932 : replace count($alerts) by is_countable($alerts)

L932

$alerts = \CMSMS\AdminAlerts\Alert::load_all();
                if( count($alerts) ) {

/* --- replace by ---- */

$alerts = \CMSMS\AdminAlerts\Alert::load_all();
                if( is_countable($alerts) ) {
      
avatar
Date: 2022-04-20 11:40
Posted By: Fernando Morgado (JoMorg)

fixed in svn thanks.
@Philippe Thomas: "is_countabl"e is not a solution as we aim to keep the PHP
compatible range as wide as possible, thanks.
      
Updates

Updated: 2022-04-20 11:40
resolution_id: => 7