webservice core_user_create_users Moodle 4.1.3+ strange error

webservice core_user_create_users Moodle 4.1.3+ strange error

by Dominique Palumbo -
Number of replies: 4
Picture of Plugin developers
Hi,

In my local environment (4.0) this call work and in the QA environment doesn't work anymore. (4.1.3+)

https://mymoodle/webservice/rest/server.php?wstoken=a1114119823a4a04a5eed63c99013etc&wsfunction=core_user_create_users&moodlewsrestformat=json&users[0][firstname]=Jean-claude&users[0][lastname]=Van%20duss&users[0][email]=Jean-
claudevanduss@example.com&users[0][username]=jcvanduss&users[0][auth]=shibboleth. Before the update from 3.9 to the 4.1 the same call worked. The database is a postgres and in dev mysql.

I never seen this error or find cocumentation on it

I've also forgot that we'rer on php 8.1 on a debian.

The url get me back

exception"Error"
message'Attempt to assign property "data" on bool'

any help will be appreciate.

Thanks.

Dominique.
Average of ratings: -
In reply to Dominique Palumbo

Re: webservice core_user_create_users Moodle 4.1.3+ strange error

by Dominique Palumbo -
Picture of Plugin developers
Hi,

If i use the API on the server : user_create_user it's work.

And other web services like enrol_manual_enrol_users, core_user_get_users, core_course_create_courses, ... work as usual.

I even try an IA to solve the problem but at the end it draw me a unicorn... but a nice one.

Dominique.
In reply to Dominique Palumbo

Re: webservice core_user_create_users Moodle 4.1.3+ strange error

by Dominique Palumbo -
Picture of Plugin developers
Hi,

I've tested the web service with PHP 7.4.x and it's work same OS, DB, Moodle that the test with php 8.1.

Is anyone have some troubles with Moodle web services and php 8.1 ?

Thanks.

Dominique.
In reply to Dominique Palumbo

Re: webservice core_user_create_users Moodle 4.1.3+ strange error

by Paul Holden -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Dominique,

I just tested on Moodle 4.2 with PHP 8.1 - all went well (the user was succesfully created):
$ curl --silent "http://localhost:8000/webservice/rest/server.php?moodlewsrestformat=json" --data "wstoken=6daa4693dc971f357b124ea340bea2de&wsfunction=core_user_create_users&users[0][firstname]=Jean-claude&users[0][lastname]=Van%20duss&users[0][email]=Jean-claudevanduss@example.com&users[0][username]=jcvanduss&users[0][auth]=shibboleth" | python -m json.tool
[
    {
        "id": 3,
        "username": "jcvanduss"
    }
]
I suggest you enable developer debugging and get the full stacktrace from the exception, and then go from there
Average of ratings: Useful (1)
In reply to Paul Holden

Re: webservice core_user_create_users Moodle 4.1.3+ strange error

by Dominique Palumbo -
Picture of Plugin developers
Hi Paul,

I'll dig more in that direction.

Thank you for your help.

Dominique.