The registration link can fail if a user's name contains a diacritic
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Medium
|
Simon Story |
Bug Description
Please note this only seems to effect PHP running on Windows, not Ubuntu.
In the following configuration:
Windows Server 2008 R2
IIS 7
Postgresql 9.1.4
PHP 5.3.13
Mahara 1.5.1
The registration link ("Hi Chéese, Thank you for registering an account on Mahara. Please follow this link to complete the signup process: ...") won't work if the user has a diacritic in their name.
Clicking the link results in "A nonrecoverable error occured. This probably means you have encountered a bug in the system"
The email address confirmation message ("Hi Chéese, Thank you for registering an account on Mahara. Please select the following link to confirm your email address. The ...") and the message sent to the administrator to approve the registration work perfectly.
Attached is a relevant snippet from the PHP error log.
tags: | added: patch translations windows |
Changed in mahara: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in mahara: | |
milestone: | none → 1.6.0 |
Changed in mahara: | |
status: | In Progress → Fix Committed |
I see this is get_new_username() using substr in a non-utf8 safe way, I think I've fixed that. Something like:
index b90a9fc..72c0a83 100644 lib/user. php lib/user. php username( $desired) { $desired, 0, $maxlen - 6) . '%')); encode( substr( utf8_decode( $desired) , 0, $maxlen - 6) . '%')));
--- a/htdocs/
+++ b/htdocs/
@@ -1402,7 +1402,7 @@ function get_new_
$taken = get_column_sql('
SELECT LOWER(username) FROM {usr}
WHERE username ' . db_ilike() . " ?",
- array(substr(
+ array(utf8_
if (!$taken) {
return $desired;
}
I think I've fixed that function, but then problem moves into create_user() :-/.
Wild speculation: I think the root of this problem is the Windows PHP binaries installed use plain libiconv 1.11 and on ubuntu php uses the bundled glibc iconv functions and things are behaving slightly differently.