Forums | Mahara Community

Mahara/Moodle integration /
Login/User creation not working for some users with Moodle webservice_xmlrpc plugin


Lena Wiere's profile picture
Posts: 3

18 September 2023, 20:56

Hi everyone,

We are currently experiencing issues with our Moodle/Mahara MNET integration. Users that have an Umlaut (ä, ö, ü, ß, ...) in any of the fields that are transferred from Moodle cannot login to Mahara and receive the error message

"A nonrecoverable error occurred. This probably means you have encountered a bug in the system"

Also, if those users don’t already exist in Mahara, they cannot be created.

Login and user creation for other users works fine and without any issues.

We decided to turn on logging for MNET in Moodle to analyse what might cause this issue. In the log data, we saw that somehow encoding of the raw data is done with iso-8859-1 and not utf-8.

[14-Sep-2023 15:27:07 Europe/Berlin] MNET DEBUG (server ourURL) RAW POST DATA
[14-Sep-2023 15:27:07 Europe/Berlin] MNET DEBUG (server ourURL) <?xml version="1.0" encoding="iso-8859-1"?>
[14-Sep-2023 15:27:07 Europe/Berlin] MNET DEBUG (server ourURL) XMLRPC Payload
[14-Sep-2023 15:27:07 Europe/Berlin] MNET DEBUG (server ourURL) <?xml version="1.0" encoding="utf-8"?>
[14-Sep-2023 15:27:07 Europe/Berlin] MNET DEBUG (server ourURL) incoming mnet request auth/mnet/auth.php/user_authorise
[14-Sep-2023 15:27:07 Europe/Berlin] MNET DEBUG (server ourURL) exiting cleanly

The issue came up after we updated our Moodle from Version 3.11 to 4.2 and with that changed from using the removed Moodle core functionality to using the webservice_xmlrpc plugin.

When checking within the files of the plugin, there is only one file that refers to iso-8859-1, which is the /webservice/xmlrpc/tests/lib_test.php that mentions iso-8859-1 as the "default encoding" in a comment:

// Encode the string without any options (default encoding "iso-8859-1" is used). Assert that decoding will work.

However, in all other files encoding is set to utf-8.

Has anyone come across something like this before? Any ideas on how we could fix or further troubleshoot this?

Thank you for any pointers or ideas you might have!

Cheers,
Lena

Kristina Hoeppner's profile picture
Posts: 4853

22 September 2023, 9:21

Hi Lena,

This sounds like a Moodle issue if the encoding changed to iso-8859-1 instead of using the standard utf-8.

Cheers

Kristina

Lena Wiere's profile picture
Posts: 3

26 September 2023, 23:47

Hi Kristina,

thanks for your response.

That was my thought as well, but I was wondering if someone here had experienced similar behaviour and found a solution. Seems there is now an update for the xmlrpc Moodle plugin available. Hopefully we're lucky and there is a fix for us included.

Cheers,
Lena

 

Sven Laudel's profile picture
Posts: 7

27 October 2023, 1:57

Hello,

I posted this on to the german Moodle Mahara Forum forum (https://moodle.hu-berlin.de/mod/forum/discuss.php?d=942529#p1642243) too, I think I've found the problem.

In the file "$MAHARA_URL/api/xmlrpc/client.php" (https://github.com/MaharaProject/mahara/blob/22.10_STABLE/htdocs/api/xmlrpc/client.php) on line 113 it says "$this-> response = xmlrpc_decode($payload);".
Mahara still uses the PHP extension XML-RPC and we can find it at https://www.php.net/manual/de/function.xmlrpc-decode.php.
Now we see, the second parameter for the call is missing (xmlrpc_decode(string $xmlstring $encoding = "iso-8859-1")) and therefore an encoding other than UTF-8 is used by default.

Now extend the line "$this->response = xmlrpc_decode($payload, 'utf-8');" and the login should work again.

By switching to the PhpXmlRpc Library, the encoding on the Moodle side has apparently changed and Mahara (at least for us) cannot handle it. Maybe it's a strange constellation for us too, who knows?

Best regards
Sven

Lena Wiere's profile picture
Posts: 3

28 October 2023, 4:09

Hi Sven,

We cannot thank you enough! Adding the encoding utf-8 as you mentioned solved the issue for us as well. Finally all our students can login to Mahara through Moodle again and we are not discriminating against our "Umlaut-Users" any more. ;)

It would be great to see this fix implemented by Mahara in order to avoid this issue in the future.

Thanks again for your help & have a great weekend!

Lena

5 results