Thanks for trying, but nope, i did create a var directly in the template. normal <?php foreach ?> works, @foreach does not. I appears that $__env is a null, why is beyond me.
OK, I added a function to app controller. tried accessing it as a variable in the template. same error occurs. besides i thought that creating arrays directly in the template and looping over them with @foreach was still legal.
This was quite a bit of time ago. From what I can recall, I either updated composer deps in the sage theme folder or just reinstalled it. Sorry not the best answer, let me know what works for you.