View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
17554Bug reportsSurvey takingpublic2021-11-02 09:06
Reportervladro93 Assigned Togabrieljenik  
PrioritylowSeveritypartial_block 
Status closedResolutionfixed 
Product Version5.x 
Summary17554: If a user has more than one email associated the methods mail_registered_participants and invite_participants fail
Description

Hello, I have a problem, I am using LS5.0.12+210729. I use the method invite_participants provided by the API with a custom token that I previously set. All things work fine if the participant has only one email address, but if he has 2 ore more it fails example: test@test.com;test2@test.com. Is there a configuration for this. I have to say that using it from the GUI provided by LS works fine.
from the GUI not guy sorry.
the problem of my understanding is this function:
if (preg_match($pattern, $oToken['email']) !== 1) {
unset($aResultTokens[$key]);
//subtract from 'left to send'
$iAllTokensCount--;
}
it will always fail for more then 1 email

Steps To Reproduce

Use the remote control api and use the invite_participants or the mail_registered_participants methods with a participant that has more than one email asociated.

TagsNo tags attached.
Bug heat10
Complete LimeSurvey version number (& build)5.0.12+210729
I will donate to the project if issue is resolvedNo
BrowserChrome / FireFox
Database type & versionMySQL 7
Server OS (if known)
Webserver software & version (if known)
PHP VersionPHP 7.2.5

Users monitoring this issue

There are no users monitoring this issue.

Activities

ollehar

ollehar

2021-08-30 13:34

administrator   ~66178

Does the system explicitly support 2+ email addresses for a single participant?

galads

galads

2021-08-30 13:41

reporter   ~66179

Last edited: 2021-09-24 13:36

This is not a bug. It only supports one email/per participant.

vladro93

vladro93

2021-08-30 14:02

reporter   ~66182

Last edited: 2021-09-24 13:36

I don't understand how the same functionality in the GUI works and from the API doesn't. Basically it should be one function that is being called. This sounds like a bug to me, but it is your call.

galads

galads

2021-08-30 14:16

reporter   ~66185

Last edited: 2021-09-24 13:36

I will test this in the GUI and get back to you

c_schmitz

c_schmitz

2021-08-30 14:17

administrator   ~66186

Last edited: 2021-09-24 13:36

Does the system explicitly support 2+ email addresses for a single participant?

Yes, always did.

galads

galads

2021-08-30 14:24

reporter   ~66188

Last edited: 2021-09-24 13:36

Indeed, it worked on the GUI.

ollehar

ollehar

2021-08-30 14:27

administrator   ~66189

Last edited: 2021-09-24 13:36

@vladro93 Maybe you can suggest a pull request or fix if you already know the problematic place in the code?

vladro93

vladro93

2021-08-30 14:28

reporter   ~66190

Last edited: 2021-09-24 13:36

c_schimtz, if the GUI works doesn't it imply that the system supports 2+ emails?

Also I have a hunch where the problem might be:

This gets called when using invite_participants from the API

if (preg_match($pattern, $oToken['email']) !== 1) {
unset($aResultTokens[$key]);
}

And this gets called from the GUI:
$aEmailaddresses = preg_split("/(,|;)/", $this->oToken->email);

I think that if should be the same in both scenarios.

vladro93

vladro93

2021-08-30 14:30

reporter   ~66191

Last edited: 2021-09-24 13:36

@ollehar i can try this, but first I have to make sure that what I found is a bug and not a new feature, as in the discussion above.

ollehar

ollehar

2021-08-30 14:36

administrator   ~66193

Last edited: 2021-09-24 13:36

Yeah, it's probably a bug. :)

vladro93

vladro93

2021-08-30 14:53

reporter   ~66196

Last edited: 2021-09-24 13:36

Here is the pull request: https://github.com/LimeSurvey/LimeSurvey/pull/2024/files

galads

galads

2021-08-30 14:57

reporter   ~66197

Last edited: 2021-09-24 13:36

Thank you for the PR, we will test and write to you if there are any questions.

gabrieljenik

gabrieljenik

2021-09-20 15:44

manager   ~66534

Last edited: 2021-09-24 13:36

Didn't find a way to easily send updates to the original PR, so created a new one.
https://github.com/LimeSurvey/LimeSurvey/pull/2041

I updated the indentation.

Also added 'continue' after the failed validations.
https://github.com/LimeSurvey/LimeSurvey/pull/2024/files#diff-22d09ac4b2de7e29721c3fc14eb239f215498a280b8c37f4b718074646f01f5dR2664

From what I tested it works OK.

Apart from that, If I'm not mistaken, when you send the emails from the UI, there is no validation.
There is one when adding a new token, but not when sending.

The one used for adding a new token uses a more complex mechanism, based on LimeMailer::validateAddress().
The current fix is OK as it updates the current RC validation to allow multiple address (minimalistic intervention), still, it is to highlight that it doens't use the same mechanism as in the UI addNew method.

Nevertheless, we are comparing addNew operations with sendEmail operation. Why should we validate when sending? Does that happen on UI version?

gabrieljenik

gabrieljenik

2021-09-30 10:54

manager   ~66671

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=32771

Related Changesets

LimeSurvey: master 56e60a23

2021-09-30 12:54

gabrieljenik

Committer: GitHub


Details Diff
Fixed issue 17554: If a user has more than one email associated the methods mail_registered_participants and invite_participants fail (#2041)

Dev Co-authored-by: Vlad Rosca
Affected Issues
17554
mod - application/helpers/remotecontrol/remotecontrol_handle.php Diff File

Issue History

Date Modified Username Field Change
2021-08-30 13:23 vladro93 New Issue
2021-08-30 13:24 ollehar Severity block => partial_block
2021-08-30 13:34 ollehar Note Added: 66178
2021-08-30 13:34 ollehar Bug heat 0 => 2
2021-08-30 13:41 galads Note Added: 66179
2021-08-30 13:41 galads Bug heat 2 => 4
2021-08-30 14:02 vladro93 Note Added: 66182
2021-08-30 14:02 vladro93 Bug heat 4 => 6
2021-08-30 14:16 galads Note Added: 66185
2021-08-30 14:17 c_schmitz Note Added: 66186
2021-08-30 14:17 c_schmitz Bug heat 6 => 8
2021-08-30 14:24 galads Note Added: 66188
2021-08-30 14:24 galads Assigned To => galads
2021-08-30 14:24 galads Status new => confirmed
2021-08-30 14:27 ollehar Note Added: 66189
2021-08-30 14:28 vladro93 Note Added: 66190
2021-08-30 14:30 vladro93 Note Added: 66191
2021-08-30 14:36 ollehar Note Added: 66193
2021-08-30 14:53 vladro93 Note Added: 66196
2021-08-30 14:57 galads Priority none => low
2021-08-30 14:57 galads Status confirmed => ready for testing
2021-08-30 14:57 galads Sync to Zoho Project => |Yes|
2021-08-30 14:57 galads Note Added: 66197
2021-09-20 15:44 gabrieljenik Note Added: 66534
2021-09-20 15:44 gabrieljenik Bug heat 8 => 10
2021-09-24 13:36 c_schmitz Assigned To galads => c_schmitz
2021-09-24 13:36 c_schmitz Status ready for testing => assigned
2021-09-27 08:28 galads Status assigned => feedback
2021-09-27 08:29 galads Assigned To c_schmitz => gabrieljenik
2021-09-27 08:29 galads Zoho Project Synchronization Yes => |Yes|
2021-09-30 10:54 gabrieljenik Changeset attached => LimeSurvey master 56e60a23
2021-09-30 10:54 gabrieljenik Note Added: 66671
2021-09-30 10:54 gabrieljenik Resolution open => fixed
2021-09-30 10:54 c_schmitz Status feedback => resolved
2021-11-02 09:06 c_schmitz Status resolved => closed