News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Invalid argument supplied for foreach()

Started by Juan Carlos, June 10, 2019, 10:18:36 AM

Previous topic - Next topic

Juan Carlos

I have this from latest GitHub

QuoteType of error: General
2: Invalid argument supplied for foreach()
https://www.cuatrocuatro.com/foro/index.php?action=profile;u=1478
/homepages/8/d361504127/htdocs/cuatro/foro/Sources/Subs-Menu.php (Line 269)

QuoteType of error: Undefined
8: Undefined index: sections
https://www.cuatrocuatro.com/foro/index.php?action=profile;u=1478
/homepages/8/d361504127/htdocs/cuatro/foro/Sources/Subs-Menu.php (Line 269)
Juan Carlos

shawnb61

Do you know what actions trigger these messages?
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Juan Carlos

No
I have more than 2000 errors in half our and all reference to the same profile (1478)

Here is the backtrace

QuoteType of error: General
Error message: 2: Invalid argument supplied for foreach()
File: /homepages/8/d361504127/htdocs/cuatro/foro/Sources/Subs-Menu.php
Line: 269
URL of page causing the error: https://www.cuatrocuatro.com/foro/index.php?action=profile;u=1478;sslRedirect
Backtrace information
#0: smf_error_handler()
Called from /homepages/8/d361504127/htdocs/cuatro/foro/Sources/Subs-Menu.php on line 269
#1: createMenu()
Called from /homepages/8/d361504127/htdocs/cuatro/foro/Sources/Profile.php on line 486
#2: ModifyProfile()
Called from /homepages/8/d361504127/htdocs/cuatro/foro/index.php on line 151

Juan Carlos

albertlast

Try this go here: https://github.com/SimpleMachines/SMF2.1/blob/release-2.1/Sources/Subs-Menu.php#L269
and change the code to:

foreach ((array) $menu_context['sections'] as $section_id => $section)

Juan Carlos

It seems that the errors stopped.
Thanks
I put this as solved
Juan Carlos

Sesquipedalian

To clarify, did the errors stop after you tried albertlast's suggestion, or did they stop spontaneously? I assume you mean the former, but I want to make sure.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Juan Carlos

I'm sorry I do not explain myself well.
The errors disappeared after making the change suggested by alberlast.

Thanks again for your job
Juan Carlos

Juan Carlos


Well it seemed that they had disappeared but no, they are not 2000 every 30 minutes but another just appeared.
>:(

QuoteError
Type of error: Undefined_vars
Error message: 8: Undefined index: sections
File: /homepages/8/d361504127/htdocs/cuatro/foro/Sources/Subs-Menu.php
Line: 269
URL of page causing the error: https://www.cuatrocuatro.com/foro/index.php?action=profile;u=1478;sslRedirect
Backtrace information
#0: smf_error_handler()
Called from /homepages/8/d361504127/htdocs/cuatro/foro/Sources/Subs-Menu.php on line 269
#1: createMenu()
Called from /homepages/8/d361504127/htdocs/cuatro/foro/Sources/Profile.php on line 486
#2: ModifyProfile()
Called from /homepages/8/d361504127/htdocs/cuatro/foro/index.php on line 151
Juan Carlos

Sesquipedalian

Hm. Is there anything unusual about that user that would cause their profile page to be different from your other users? I am trying to figure out what is causing the menu structure to behave so strangely for that user.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

shawnb61

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Juan Carlos

Well, now there are a few more errors but from other users.
So it does not seem to be a specific problem with that user.

Juan Carlos

SychO

The error occurs when the guest is not allowed to see member profiles
this pull request will fix the issue
https://github.com/SimpleMachines/SMF2.1/pull/5712
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Sesquipedalian

I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Advertisement: