Fatal XML Error installing Moodle 3.1.1.4

Fatal XML Error installing Moodle 3.1.1.4

by vantec europe -
Number of replies: 8

Hi, I have an error when trying to install Moodle 3.1.14. This happens at the very beginning of the installation. So, I type in localhost/moodle and I get the error below.

Fatal error: Type of xml_format_exception::$line must be int (as in class Exception) in C:\inetpub\wwwroot\moodle\lib\xmlize.php on line 42

I have looked at the php file and cannot see anything wrong with it, however I'm not a php programmer. PHP is setup correctly and all XML updates are installed.

I have attached a copy of the xmlize.php file. Thanks in advance.


Average of ratings: -
In reply to vantec europe

Re: Fatal XML Error installing Moodle 3.1.1.4

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

I suspect you have PHP 8.1.0. Assuming you have Moodle 3.11.4 then this requires PHP 7.3 or 7.4.

Average of ratings: Useful (1)
In reply to Leon Stringer

Re: Fatal XML Error installing Moodle 3.1.1.4

by Danijel Todic -

It seems moodle is still also with the newest version 3.11.5 not php8 compatible   🧐
Although php release was november 2020 🥱
https://docs.moodle.org/dev/Moodle_and_PHP

if you switch for example to php 7.4 moodle works 🏎️
PHP7 EOL is November 2022 https://www.php.net/supported-versions.php

In reply to vantec europe

Re: Fatal XML Error installing Moodle 3.1.1.4

by H Gonzalez -

I had a similar error message (my error message indicated that the problem was on line 0, which doesn't make any sense).  But to resolve this problem I added the 'int' type to $line.

Look for:

public $line;

and change that to:

public int $line;

This for me was located near the top of the file around line 46.

In reply to H Gonzalez

Re: Fatal XML Error installing Moodle 3.1.1.4

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You've not fixed it if you had to change core code.
Average of ratings: Useful (1)
In reply to H Gonzalez

Re: Fatal XML Error installing Moodle 3.1.1.4

by David Dzikowski -
My installation broke when I upgraded to Ubuntu 22.04 LTS. This was the fix for me too. Thank you very much for posting!
In reply to David Dzikowski

Re: Fatal XML Error installing Moodle 3.1.1.4

by H Gonzalez -
Please remember that Moodle 3.11.3 is not yet ready for php 8. My specific use case was to prepare our particular moodle installation for migration, and we will not use Moodle 3.11 with php 8 until probably this fall. We are currently on moodle 3.9
In reply to David Dzikowski

Re: Fatal XML Error installing Moodle 3.1.1.4

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I'm going to say it again. If you had to change core code then you haven't fixed it.