According to the debugger, the error is caused in the line of the if. At least that line is highlighted in the code snipped shown in the debugger. And $menu is only used there due to the fact that it is a static value in the template; not a vairable itself.
You were right @texnixe! I found another spot I forgot about in an old template. There was a call without the value passed as a variable. Notepad++ search helped me!
Sorry for wasting your time with this obvious mistake. I didn’t remember I placed it there in the past; maybe I did it because I followed a tutorial back then.
The backtrace is a good hint! I found out that at some steps earlier, there is the old template spot with the mistake marked. Now I know how/that I should check the backtrace in other cases like this!
The variable should be set all time to at least one of two possible values so it is fine if it errors.
Yes, but there’s a difference between what should be and what actually happens. So it is good practice to either check for the variable and/or to set a default value.