CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#12634] MenuManager core module is incompatible with PHP 8.1

avatar
Created By: Jean-François S. (FatRabbit)
Date Submitted: Tue Jul 25 14:27:58 -0400 2023

Assigned To:
Version: 2.2.17
CMSMS Version: 2.2.17
Severity: Major
Resolution: Accepted
State: Open
Summary:
MenuManager core module is incompatible with PHP 8.1
Detailed Description:
MenuManager uses the each() construct which is deprecated in PHP 8.1.

Quick and dirty fix:
*** MenuManager.module.php      2023-07-25 20:24:31.380937841 +0200
--- MenuManager.module.php.orig 2023-07-25 20:21:12.312061045 +0200
***************
*** 108,115 ****
        reset($children);
        $nchildren = count($children);
        $nc = -1;
! #     while (list($key) = each($children)) {
!       foreach ($children as $key => $value) {
          $nc++;
          $onechild =& $children[$key];
          $content = $onechild->GetContent($deep);
--- 108,114 ----
        reset($children);
        $nchildren = count($children);
        $nc = -1;
!       while (list($key) = each($children)) {
          $nc++;
          $onechild =& $children[$key];
          $content = $onechild->GetContent($deep);


History

Comments
avatar
Date: 2023-08-09 18:41
Posted By: tom (tomphantoo)

The MenuManager module is to be exported from CMSMS core back to an ordinary
CMSMS module.
A new maintainer (Hammy) has recently been appointed.
Hammy has provided a new version of the module which includes the fix you've
suggested, plus several others to bring the module to CMSMS2.2 compatibility and
recent-PHP compatibility.
That new version is not yet available from the Forge, but if you would like an
'advanced copy' of it, please advise.
      
Updates

Updated: 2023-08-09 18:41
resolution_id: => 6