zip_archive::rewind() PHP 8.1 Fatal error after site migration

zip_archive::rewind() PHP 8.1 Fatal error after site migration

by heli g -
Number of replies: 3
I migrated a Moodle 4.1 instance from Ubuntu 20.04 to an Ubuntu 22.04 server with PHP 8.1 this weekend.
Can anyone help with this error, I have no luck with searches so far:

PHP Fatal error:  Declaration of zip_archive::rewind(): void must be compatible with Iterator::rewind(): float|false in .../lib/filestorage/zip_archive.php on line 541


The line reads:

    /**
     * Rewinds back to the first file.
     */
    public function rewind(): void {
        $this->pos = 0;
    }
I would greatly appreciate any assistance.
Average of ratings: -
In reply to heli g

Re: zip_archive::rewind() PHP 8.1 Fatal error after site migration

by heli g -
More info: The migration seems to have been successful, but I woke up this morning to a white page and that error filling the php error log and panicked, hence this post. The white page was resolved by allowing apache to read config.php (I wonder how it functioned fine for 18 hours without this basic permission set?!)
I have since been monitoring the php error log, the site is under heavy use and I do not see that error anymore. So perhaps this is a false alarm?
In reply to heli g

Re: zip_archive::rewind() PHP 8.1 Fatal error after site migration

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Probably moodledata/muc/config.php?
In reply to Visvanath Ratnaweera

Re: zip_archive::rewind() PHP 8.1 Fatal error after site migration

by heli g -
Yeah. Seems like that scary error is logged when apache can't read config.php... that's my hypothesis anyway. It's gone now.