View Issue Details

This issue affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
20457Bug reportsSurvey participants (Tokens)public2026-03-13 12:01
Reporterriku Assigned To 
PrioritynoneSeveritycrash 
Status newResolutionopen 
Product Version6.16.x 
Summary20457: tableExists helper function returns outdated result due to cache
Description

We ran into the issue where on survey activation with closed-access mode and public registration allowed, a database error was thrown if the survey had been activated in open access mode previously. The database error stated that the finaltokens table already existed. Digging deeper, the SurveyAccessModeService->newParticipantTable method was called twice under these exact conditions, once via SurveyActivate->activate and once via SurveyAccessModeService->changeAccessMode. Obviously on the second call the table already existed and $survey->hasTokensTable should have caught that, but no.

So long story short, the tableExists helper in application/helpers/common_helper.php used cached results on the second call, meaning $survey->hasTokensTable was still false and an unsuccessful attempt was made to create the finaltokens table once more.

Steps To Reproduce

Steps to reproduce

  1. Create a new survey and allow public registration.
  2. Activate the survey in open-access mode. Everything should be alright so far.
  3. Deactivate the survey.
  4. Attempt to activate the survey again in closed-access mode.

Expected result

Survey is activated without errors on the second attempt.

Actual result

Survey activation causes a database error.

TagsNo tags attached.
Bug heat2
Complete LimeSurvey version number (& build)6.16.12+26030
I will donate to the project if issue is resolvedNo
Browser
Database type & version-
Server OS (if known)
Webserver software & version (if known)
PHP Version8.3

Users monitoring this issue

There are no users monitoring this issue.

Activities

riku

riku

2026-03-13 12:01

reporter   ~84452

PR created: https://github.com/LimeSurvey/LimeSurvey/pull/4771

Issue History

Date Modified Username Field Change
2026-03-13 11:58 riku New Issue
2026-03-13 12:01 riku Note Added: 84452
2026-03-13 12:01 riku Bug heat 0 => 2