A user registered himself, and chooses as login a name with uppercases (Stephane).
Two newsletter are created, with different subscriptions:
1) group subscription, including the aforementioned user
2) user self subscribe
When sending newsletter 1, the email is sent to the user.
When sending newsletter 2, the email address of the user is not found in the database and cannot be sent (despite finding the correct number of subscribers)
I traced it to two libraries:
first in ./lib/newsletter/nllib.php, in the function get_all_subscriber, we can see in the first part of the function how the email adresses are collected based on the subscribed groups. The select is mostly direct, and gets the correct information.
Later in the function (line 215 and following), individual users are added to the list of emails. Line 218, the "email" from the table tiki_newsletter_subscriptions (which is the login for registered users) is brought to lower case. (Note: I'm not sure, but it could be that the subscription module also puts the login in lower case in that table...)
Finally, line 232, the function get_user_email uses as parameter this lowercase login name to find out the actual email address.
This function is defined in the library ./lib/userlibs.php on line 5581.
This function compares the login passed as parameter to the login in the users_users table, but with a "binary" comparison, i.e. case sensitive! Removing the binary keyword lets the newsletter module find the correct user, and then its email.
Update: actual fix is better done in /lib/newsletter/nllib.php
It has been done in trunk, commit 41587.
Login handling is still case sensitive, now the newsletter handle it correctly. Will be backported to 9.x when 9.0 is out.
I propose to change the login comparison to a normal (non-binary, case-insensitive) comparison. Only question remaining: there was surely a good reason to have a binary comparison, and what else would break if we remove the binary comparison?
@@ -5580,7 +5580,7 @@
function get_user_email($user) {
global $prefs;
- return ( $prefs'login_is_email' == 'y' && $user != 'admin' ) ? $user : $this->getOne("select `email` from `users_users` where binary `login`=?", array($user));
}
function get_userId_what($userIds, $what='email') {
$query = "select `$what` from `users_users` where `userId` in (".implode(',',array_fill(0, count($userIds),'?')).')';
To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tiki.org instance. To start, simply select a version and click on "Create show2.tiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show2.tiki.org.
filename | created | hits | comment | version | filetype | ||
---|---|---|---|---|---|---|---|
No attachments for this item |