View Issue Details

IDProjectCategoryView StatusLast Update
0010780mantisbtemailpublic2010-02-22 14:35
ReporterSL-Gundam Assigned Tograngeway  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformPHP 5.3.0OSWindows XP SP2 64BitOS Version5.2 (Build 3790)
Product Versiongit trunk 
Fixed in Version1.2.0 
Summary0010780: language of emails could be wrong in specific situations
Description

After some checking and debugging i came to the following conclusion

in user_pref_api.php on line 222 the following query is used

$query = "SELECT *
FROM $t_user_pref_table
WHERE id IN (" . implode( ',', $c_user_id_array ) . ') AND project_id=' . db_param();

Now everything works ok as long as the id of the user_pref is the same as the user_id.

But when they are not the same the function user_pref_cache_array_rows either retrieves a different row or none at all.

This causes problems when the system is collecting users to send emails to.

in various situations i had user accounts with dutch and english language settings, but the users with the english language setting received emails in dutch.

My default system langauge for mantis is Dutch so that is probably why the emails for those users were in dutch when mantis couldn't find the user_prefs for them

Conclusion: "WHERE id IN" should have been "WHERE user_id IN"
Various lines after this in the same function would also need this change when referencing $g_cache_user_pref and $c_user_id_array

TagsNo tags attached.

Relationships

has duplicate 0011483 closeddhx Wrong user preferences read when sending email notifications 

Activities

Olaf123

Olaf123

2009-07-30 04:30

reporter   ~0022606

I seem to have the same or a similar problem in version 1.2rc1. The default language of my system is English but some users are Dutch. Suddenly, English users are getting Dutch email. I haven't figured out why yet, but this will cause a mess as soon as I get German users as well. As soon as a know more details I'll add them.

SL-Gundam

SL-Gundam

2009-07-30 12:03

reporter   ~0022616

Last edited: 2009-07-30 12:03

i started getting this problem in the 1.2.0rc1 and then got the git to retest it there.

So thrust me when i say that you have the same problem

grangeway

grangeway

2009-07-30 15:29

reporter   ~0022619

Fixed

http://git.mantisforge.org/w/mantisbt.git?a=commitdiff;h=bba71f0a3b493783dc1c4de37d5ecf3389f9239b

Paul

SL-Gundam

SL-Gundam

2009-07-30 18:17

reporter   ~0022620

As far as i can see from the fix you only fixed the query and not the further references to the column in the same function.

See the last line from the original issue: "Various lines after this in the same function would also need this change when referencing $g_cache_user_pref and $c_user_id_array"

I believe they should be adjusted aswell to user_id

grangeway

grangeway

2009-07-31 09:12

reporter   ~0022634

Fixed

SL-Gundam

SL-Gundam

2009-08-14 08:21

reporter   ~0022726

I can still not see the required changes in the git tree - http://git.mantisbt.org/?p=mantisbt.git;a=blob;f=core/user_pref_api.php;hb=HEAD

All $row['id'] should be $row['user_id'] as earlier specified

When will these changes be added to the git?

SL-Gundam

SL-Gundam

2009-08-25 11:07

reporter   ~0022813

I just checked the latest nightly build (mantisbt-1.2.0rc2-2009-08-25-master-1.2.x-f4c02f6.zip) and its still not fixed, even the query fix is not present there.

Also when i check http://git.mantisbt.org/?p=mantisbt.git;a=blob;f=core/user_pref_api.php;h=eed375e8632a5d44c253eab6a5bfabeccfcadb1d;hb=HEAD, the query fix is present but all the "$row['id']" in the function still have not been changed to "$row['user_id']"

Is there any reason why this has still not been modified? If what i'm saying is wrong (either the status of the changes or the way it should be fixed) please let me know

squarebox

squarebox

2009-11-29 23:40

reporter   ~0023822

this bug still exists in 1.2.0rc2... i too have this problem, albeit with japanese and english.

SL-Gundam

SL-Gundam

2010-01-12 09:11

reporter   ~0024131

This seems to be fixed correctly in the current master in the git tree

Can be closed

dhx

dhx

2010-02-09 23:10

reporter   ~0024355

Oops we forgot to backport this fix to the 1.2.x branch! I've done it now (thanks to tomc from bringing it to my attention). Hopefully this fixes a number of issues we've been having with emails in MantisBT 1.2.x+

Related Changesets

MantisBT: master bba71f0a

2009-07-30 15:17

Paul Richards


Details Diff
Fix 0010780: language of emails could be wrong in specific situations Affected Issues
0010780
mod - core/user_pref_api.php Diff File

MantisBT: master-1.2.x d09f09b8

2009-07-30 15:17

Paul Richards

Committer: dhx


Details Diff
Fix 0010780: language of emails could be wrong in specific situations

Signed-off-by: David Hicks <hickseydr@optusnet.com.au>
Affected Issues
0010780
mod - core/user_pref_api.php Diff File