1
Hi everyone.
I found a bug and a fix editing user's profile, but before inserting it in the bug tracker, I want to discuss some points:
1 - I found it in XOOPS 2.0.16 EXM, not in latest release
2 - It only happens in languages that use comma as float numbers separator, such as spanish.
This is the problem. A number with decimals is written this way in english...
Pi = 3.14
...and this way in spanish...
Pi = 3,14
Notice the comma instead of the dot.
OK, when editing user's profile, timezone offset is inserted in the database in float format IN A WAY THAT CONSIDERS LOCALE SETTINGS, so it tries to insert...
timezone_offset = 1,00,
...in the database, which causes a error.
This is the code that causes the problem:
file kernel/user.php, line 528
Quote:
$sql = sprintf("UPDATE %s SET uname = %s, name = %s, email = %s, url = %s, user_avatar = %s, user_icq = %s, user_from = %s, user_sig = %s, user_viewemail = %u, user_aim = %s, user_yim = %s, user_msnm = %s, posts = %d, pass = %s, attachsig = %u, rank = %u, level= %u, theme = %s, timezone_offset = %.2f, umode = %s, last_login = %u, uorder = %u, notify_method = %u, notify_mode = %u, user_occ = %s, bio = %s, user_intrest = %s, user_mailok = %u WHERE uid = %u", ...
And this is the fix: Ignore locale settings for this number.
Quote:
$sql = sprintf("UPDATE %s SET uname = %s, name = %s, email = %s, url = %s, user_avatar = %s, user_icq = %s, user_from = %s, user_sig = %s, user_viewemail = %u, user_aim = %s, user_yim = %s, user_msnm = %s, posts = %d, pass = %s, attachsig = %u, rank = %u, level= %u, theme = %s, timezone_offset = %.2F, umode = %s, last_login = %u, uorder = %u, notify_method = %u, notify_mode = %u, user_occ = %s, bio = %s, user_intrest = %s, user_mailok = %u WHERE uid = %u", ...
Notice the red uppercase F.
Now the bad news: it requires PHP 4.3.10 or higher. It works for me, but I'd prefer a more compatible solution.
Any comments, please?