Invalid hash on elgg join

Invalid hash on elgg join

Graeme Forrester
Vastuste arv 3

Hi,

I have a slight problem with user login from moodle to elgg. I have LDAP initiated and for most users it works fine.

Some of my users have the number 0 at the start of their usernames which I believe is causing the problem eg 0118345 as a username and it returns an invalid hash.

Is there any way to fix this? Elgg works with this login but drops the 0 from the start of the username.

Keskmine hinnang: -
Vastuses Graeme Forrester

Re: Invalid hash on elgg join

Martín Langhoff
Ouch! That must be a bug related to PHP mixing up positional arrays and named arrays. I am thinking of the array behaviour as described here: http://bugs.php.net/bug.php?id=34068
Vastuses Martín Langhoff

Re: Invalid hash on elgg join

Graeme Forrester

Hi Martin,

I dont believe this is php related but rather elgg related. I posted a blog on their site as follows

"I have an elgg install and will be using LDAP usernames although I have not at this point installed LDAP on the elgg module.

Many of my users have the number 0 at the start and it disappears in the db and user profile from the admin menu. Is there anyway to allow the number 0 to be valid iat the start of a username?

eg 0111111 is returned as 111111 although the 01111111 allows login but is not supported in the db or the admin management. "

Moodle quite gracefully accepts the 0 at the start of the username and elgg doesn't which i believe is the root of the problem. I don't know how to fix it. All of my other users that start with a letter character or any other number are OK. This all seems to be beahviour that I have seen in excel on non preformatted lists before.

This is the final hurdle and I need a fix but the fix needs to come from elgg.

Any ideas? 

Vastuses Graeme Forrester

Re: Invalid hash on elgg join

Graeme Forrester

If this is php converting a number to integer and then dropping the 0 at the start - is there a way of fixing? It is username and shouldn't it stay as text rather than be converted to integer?

I have 4 other php apps running and none of them exhibit this behaviour with the number 0 at the start eg 01111111 and all store that in the database. Elgg for some reason drops the 0 no matter what. Moodle is fine with it - so there must be some difference in the way that Moodle and Elgg are passing and treating usernames.

The php bug link refers to 2005 - I have the newer version fro 2006 where that issue is fixed.

I really don't know where to look to fix this up. Anyone got any ideas?