1
nachenko
Bug editing users profile
  • 2007/9/21 8:42

  • nachenko

  • Quite a regular

  • Posts: 356

  • Since: 2005/1/18


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?

2
Anonymous
Re: Bug editing users profile
  • 2007/9/21 8:52

  • Anonymous

  • Posts: 0

  • Since:


Quote:
nachenko wrote:

1 - I found it in XOOPS 2.0.16 EXM, not in latest release


Quote:
nachenko wrote:

Any comments, please?


The code that you have mentioned (line 528, kernel/user.php) is the same in the current 2.0.17 release.

Does changing the "f" to "F" adversely affect those languages which use "." rather than ","?

3
nachenko
Re: Bug editing users profile
  • 2007/9/21 8:57

  • nachenko

  • Quite a regular

  • Posts: 356

  • Since: 2005/1/18


Quote:
Does changing the "f" to "F" adversely affect those languages which use "." rather than ","?


It shouldn't, as lowercase "f" means "consider locale settings" and uppercase F means "ignore locale settings"

Login

Who's Online

264 user(s) are online (179 user(s) are browsing Support Forums)


Members: 0


Guests: 264


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits