./auth/ldap/cli/sync_users.php throws a potential coding error for a prohibited username

./auth/ldap/cli/sync_users.php throws a potential coding error for a prohibited username

by Visvanath Ratnaweera -
Number of replies: 2
Picture of Particularly helpful Moodlers Picture of Translators
[Moodle 2.7.17+ on LAMP Debian Jessy]

This site was stable since a major upgrade a couple of months ago. A couple of days ago the user synchronization stopped. The error message is copied here.

Obviously there is a prohibited username. The problem is, I do not get a decent error message, can't get the username in the output, and "potential coding error" is not very reassuring!

Is this known? Or, how can I find out the offending username? (The debug level has no effect on the output below.)

===
# /usr/bin/php /var/www/html/moodle/auth/ldap/cli/sync_users.php
Verbindung zum LDAP-Server aufbauen...Temporäre Tabelle tmp_extuser erstellen.
.........................................................................................
755 Datensätze von LDAP eingelesen
Keine Nutzerkonten zum Entfernen gefunden
Keine Nutzerkonten zum Reaktivieren gefunden
Keine Aktualisierung nötig
Nutzerkonten zum Hinzufügen: 11Database transaction aborted automatically in /var/www/html/moodle/auth/ldap/cli/sync_users.php
Default exception handler: Der Anmeldename enthält ungültige Zeichen Debug:
Error code: invalidusername
* line 49 of /user/lib.php: moodle_exception thrown
* line 954 of /auth/ldap/auth.php: call to user_create_user()
* line 63 of /auth/ldap/cli/sync_users.php: call to auth_plugin_ldap->sync_users()

!!! Der Anmeldename enthält ungültige Zeichen !!!
!!
Error code: invalidusername !!
!! Stack trace: * line 49 of /user/lib.php: moodle_exception thrown
* line 954 of /auth/ldap/auth.php: call to user_create_user()
* line 63 of /auth/ldap/cli/sync_users.php: call to auth_plugin_ldap->sync_users()
!! Potential coding error - existing temptables found when disposing database. Must be dropped!
Average of ratings: -
In reply to Visvanath Ratnaweera

Re: ./auth/ldap/cli/sync_users.php throws a potential coding error for a prohibited username [HALF SOLVED]

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Found the offending user, had a hash (#) in the username!

Thanks to these two posts:
- https://moodle.org/mod/forum/discuss.php?d=327662#p1334774
- https://moodle.org/mod/forum/discuss.php?d=327662#p1335036
(Ken, let me know if your Karma box has become too heavy. ;)

So the remaining question is, why does it lead to a coding error?
Average of ratings: Useful (2)