View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
19394Bug reportsOtherpublic2024-03-04 12:34
ReporterJmantysalo Assigned Tomfavetti  
PrioritynoneSeveritytweak 
Status closedResolutionfixed 
Product Version6.4.x 
Summary19394: Off-button not shown in 'Create example question group and question:'
Description

In Configuration > Global > Create example question group and question there is an On/Off -button. It works. However, if you choose Off and save settings, then neither On or Off is shown as selected.

TagsNo tags attached.
Bug heat10
Complete LimeSurvey version number (& build)6.4.4+240130
I will donate to the project if issue is resolvedNo
Browser
Database type & versionN/A
Server OS (if known)
Webserver software & version (if known)
PHP VersionN/A

Users monitoring this issue

mfavetti

Activities

mfavetti

mfavetti

2024-02-22 11:06

developer   ~79575

This affects all global settings that are On/Off and cast to Boolean:
createsample
rpc_publish_api
add_access_control_header

Problem is as follows:
On => "1", Off => "0"
value is cast to Boolean when storing the setting
On => true, Off => false
db field is text and php converts boolean to string, true => "1" and false => ""
so, true gets stored in db as "1", false gets stored in db as an empty string, but the code expects to load a "1" or a "0"

other global settings that appear as On/Off , but are unaffected fall under the following cases:

  • values changed to Y/N: "1" => "Y", "0" => "N" (already strings)
  • values cast to integer: "1" => 1, "0" => 0 (which end up as "1" and "0" when cast back to strings)
  • values used directly: "1", "0" (already strings)

So there are 4 different ways of handling a checkbox present

mfavetti

mfavetti

2024-02-22 11:16

developer   ~79576

could just remove cast to boolean if there are no objections

mfavetti

mfavetti

2024-02-27 23:01

developer   ~79673

https://github.com/LimeSurvey/LimeSurvey/pull/3765

DenisChenu

DenisChenu

2024-02-28 08:12

developer   ~79674

Needed fort 5 https://github.com/LimeSurvey/LimeSurvey/blob/07e3666d4114709dd7570dbff8e990823a82a4d1/application/controllers/admin/globalsettings.php#L391 ?

Seems here since years, why it appear now ?

mfavetti

mfavetti

2024-02-28 16:29

developer   ~79682

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

tibor.pacalat

tibor.pacalat

2024-02-28 16:32

administrator   ~79683

@mfavetti can you port this to 5.x as well?

mfavetti

mfavetti

2024-02-28 20:52

developer   ~79688

@tibor.pacalat

no need, doesn't affect 5.x

mfavetti

mfavetti

2024-02-28 20:53

developer   ~79689

@DenisChenu

i did not look into this too deeply, but visually, 5.x used some sort of on/off slider and 6.x uses a button group

must be some difference in implementation between the two types of inputs

DenisChenu

DenisChenu

2024-02-29 09:27

developer   ~79691

:+1: thanks

LimeBot

LimeBot

2024-03-04 12:34

administrator   ~79707

Fixed in Release 6.4.11+240304

Related Changesets

LimeSurvey: master 52991e08

2024-02-28 16:29:37

mfavetti


Committer: GitHub Details Diff
Fixed issue 19394: Off-button not shown in 'Create example question group and question:' (03765) Affected Issues
19394
mod - application/controllers/admin/globalsettings.php Diff File

Issue History

Date Modified Username Field Change
2024-02-04 06:08 Jmantysalo New Issue
2024-02-22 11:06 mfavetti Assigned To => mfavetti
2024-02-22 11:06 mfavetti Status new => confirmed
2024-02-22 11:06 mfavetti Note Added: 79575
2024-02-22 11:06 mfavetti Bug heat 0 => 2
2024-02-22 11:16 mfavetti Note Added: 79576
2024-02-22 11:16 mfavetti Issue Monitored: mfavetti
2024-02-22 11:16 mfavetti Bug heat 2 => 4
2024-02-27 23:01 mfavetti Note Added: 79673
2024-02-27 23:03 mfavetti Assigned To mfavetti => DenisChenu
2024-02-27 23:03 mfavetti Status confirmed => ready for code review
2024-02-28 08:12 DenisChenu Note Added: 79674
2024-02-28 08:12 DenisChenu Bug heat 4 => 6
2024-02-28 08:30 DenisChenu Assigned To DenisChenu => tibor.pacalat
2024-02-28 08:30 DenisChenu Status ready for code review => ready for testing
2024-02-28 16:29 mfavetti Changeset attached => LimeSurvey master 52991e08
2024-02-28 16:29 mfavetti Note Added: 79682
2024-02-28 16:29 mfavetti Assigned To tibor.pacalat => mfavetti
2024-02-28 16:29 mfavetti Resolution open => fixed
2024-02-28 16:32 tibor.pacalat Note Added: 79683
2024-02-28 16:32 tibor.pacalat Bug heat 6 => 8
2024-02-28 20:52 mfavetti Note Added: 79688
2024-02-28 20:53 mfavetti Note Added: 79689
2024-02-29 09:27 DenisChenu Note Added: 79691
2024-02-29 10:52 tibor.pacalat Status ready for testing => resolved
2024-03-04 12:34 LimeBot Note Added: 79707
2024-03-04 12:34 LimeBot Status resolved => closed
2024-03-04 12:34 LimeBot Bug heat 8 => 10