Quick PHP 8 fix for MenuManager please!

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
Charles Butcher
Forum Members
Forum Members
Posts: 103
Joined: Sat Jul 05, 2008 8:25 pm
Location: Norfolk, UK

Quick PHP 8 fix for MenuManager please!

Post by Charles Butcher »

I would be very grateful if someone could tell me how to patch the MenuManager module to work with PHP 8. The "each" at line 111:

Code: Select all

while (list($key) = each($children)) {
breaks the site. I tried:

Code: Select all

foreach( $children as $key ) {
without success. I know I should probably be using Navigator instead, but I'm not a developer and until I can get my head round that I'd like to keep it working with MenuManager and PHP 8 if possible.

Any hints appreciated.
MantaPro
Forum Members
Forum Members
Posts: 97
Joined: Sun Feb 03, 2008 8:14 pm

Re: Quick PHP 8 fix for MenuManager please!

Post by MantaPro »

Try

Code: Select all

 foreach ($children as $key => $value)
In the old code the each returns the key & value pairs. The list assigns the key but ignores the value.

In your attempted code you were looping through the children and assigning the value to a field called key. Whereas you want the field called key to hold the key.

Good luck
User avatar
Charles Butcher
Forum Members
Forum Members
Posts: 103
Joined: Sat Jul 05, 2008 8:25 pm
Location: Norfolk, UK

Re: Quick PHP 8 fix for MenuManager please!

Post by Charles Butcher »

Thank you very much indeed! That works. Now the errors have moved to old modules like CGGoogleMaps – but it's progress :-)
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1757
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Quick PHP 8 fix for MenuManager please!

Post by DIGI3 »

Just a reminder that source code changes are not permitted on the forum (there's pinned posts outlining the reasoning so I won't get into it here). Also keep in mind MenuManager was deprecated years ago, and will stop being included very soon. Migrating to Navigator is the best option.
Not getting the answer you need? CMSMS support options
User avatar
Charles Butcher
Forum Members
Forum Members
Posts: 103
Joined: Sat Jul 05, 2008 8:25 pm
Location: Norfolk, UK

Re: Quick PHP 8 fix for MenuManager please!

Post by Charles Butcher »

Thanks DIGI3, and apologies for breaking that rule – which makes perfect sense. I'll get to grips with Navigator. I inherited the original MenuManager template in 2009 as part of a complete site design, so I have never needed to understand it. This will be a useful learning experience.
ohaldi
New Member
New Member
Posts: 8
Joined: Wed Feb 18, 2009 5:46 pm

Re: Quick PHP 8 fix for MenuManager please!

Post by ohaldi »

foreach ($children as $key => $value)

I also have this problem now. I changed this line 111 to the above line.
But now I have one error at line :
Parse error: syntax error, unexpected token "return", expecting "function" or "const" in /home/httpd/vhosts/haldi.ch/httpdocs/cms/modules/MenuManager/MenuManager.module.php on line 181

Could somebody send me this MenuManager php file?
Regards
User avatar
Charles Butcher
Forum Members
Forum Members
Posts: 103
Joined: Sat Jul 05, 2008 8:25 pm
Location: Norfolk, UK

Re: Quick PHP 8 fix for MenuManager please!

Post by Charles Butcher »

I've sent you a PM. But I am puzzled how you were able to patch line 111 if you don't have access to MenuManager.module.php – this new error is just line 181 in the same file. Good luck in fixing it. DIGI3 did a wonderful job on upgrading my own site so that I no longer need to use MenuManager.
ohaldi
New Member
New Member
Posts: 8
Joined: Wed Feb 18, 2009 5:46 pm

Re: Quick PHP 8 fix for MenuManager please!

Post by ohaldi »

I made too many mistakes with CMSMS.
I deleted the MenuManager module before changing anything. It was a big mistake.
Now I have problems everywhere. Also, the content manager template shows **ERROR**.
The CMS management still work well.
I'm going to ask my supplier to restore a backup from last month. If that's not possible. Then I'll probably look for another CMS.
Which is strange with the PHP 8.3 update from the host. A few months ago, I was already using PHP 8 and everything was working fine.
Thanks again for all your help.
jce76350
Beta Tester
Beta Tester
Posts: 2069
Joined: Mon May 29, 2006 1:20 pm
Location: Rouen

Re: Quick PHP 8 fix for MenuManager please!

Post by jce76350 »

@ ohaldi see may answer on the FR forum ;)
Jean-Claude Etiemble MyPageFr
Post Reply

Return to “Modules/Add-Ons”