View Issue Details

This bug affects 1 person(s).
IDProjectCategoryView StatusLast Update
18862Bug reportsExpression Managerpublic2023-08-18 17:42
ReporterCoreyfournier Assigned To 
Status feedbackResolutionopen 
Product Version6.1.x 
Summary18862: Expression manager doesn't resolve jsName

In the file em_manager_helper there is a logic error that never resolves jsName or JsName_on. This is in the function _GetVarAttribute.

In the case JsName the logic is below:

return (isset($var['jsName_on']) ? $var['jsName_on'] : isset($var['jsName'])) ? $var['jsName'] : $default;

It has nested inline if statements. The first in line is passed to the next. The output of the first if is not a boolean "$var['jsName_on']", but the second is "isset($var['jsName'])". The whole statement is basically jacked up as it's a string as input into another if statement.

This isn't the only problem as the below code in the function setVariableAndTokenMappingsForExpressionManager always clears out js name on. So "isset($var['jsName_on'])" is always true and set to an empty string.

        // Hidden question are never on same page (except for equation)
        if ($hidden && $type != Question::QT_ASTERISK_EQUATION) {
            $jsVarName_on = '';

I think the logic should be rewritten as follows :

return $var['jsName'];
else if(isset($var['jsName_on']))
return $var['jsName_on'];
return $default;

Steps To Reproduce

Steps to reproduce

Add a question and an expression to use the Question.jsName.

Expected result


Actual result


(Write here what happened instead)

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)6.1
I will donate to the project if issue is resolvedNo
Database type & versionMysql
Server OS (if known)
Webserver software & version (if known)
PHP VersionLatest

Users monitoring this issue

User List There are no users monitoring this issue.




2023-06-06 17:56

developer   ~75451

The function clear jsVarName_on for hidden question.

Hidden question are not in page, there don't have a jsVarName

Add a question and an expression to use the Question.jsName.

Please : a sample survey



2023-08-17 15:48

administrator   ~76632

@Coreyfournier could you please provide a sample survey where this is happening?

Issue History

Date Modified Username Field Change
2023-06-06 17:35 Coreyfournier New Issue
2023-06-06 17:56 DenisChenu Note Added: 75451
2023-06-06 17:56 DenisChenu Bug heat 0 => 2
2023-08-17 15:48 tibor.pacalat Assigned To => tibor.pacalat
2023-08-17 15:48 tibor.pacalat Status new => feedback
2023-08-17 15:48 tibor.pacalat Note Added: 76632
2023-08-17 15:48 tibor.pacalat Bug heat 2 => 4
2023-08-18 17:42 tibor.pacalat Assigned To tibor.pacalat =>