PHP 8 Error "Undefined property"

I have an older slideshow block (originally developed v. 5.7) and want to make it work under v.9 and PHP8. It works fine with PHP7.4 but when I switch to PHP8 it throws an error in the controller:
Undefined property: Concrete\Package\InfiniteSlideshow\Block\InfiniteSlideshow\Controller::$fileOrder

It’s within an if statement:

if ($this->fileOrder == 'date_asc')
                $fl->sortBy('fDateAdded', 'asc');

Can this be done by myself - with basic knowledge of PHP?

Thanks a lot

Yeah, you need to add property in block controller

public $fileOrder;

An it will look something like that:

class Controller extends BlockController
{
    public $fileOrder;
    // rest of methods
}
2 Likes

hi thank you. i lke it

Thank you very much, that was easy, - even for me. There was another error popping up for “undefined Variable” in view.php. I was able to manage that one too thanks to your instructions

2 Likes