View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 20457 | Bug reports | Survey participants (Tokens) | public | 2026-03-13 11:58 | 2026-09-17 14:29 |
| Reporter | riku | Assigned To | c_schmitz | ||
| Priority | none | Severity | crash | ||
| Status | closed | Resolution | fixed | ||
| Product Version | 6.16.x | ||||
| Summary | 20457: 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
Expected resultSurvey is activated without errors on the second attempt. Actual resultSurvey activation causes a database error. | ||||
| Tags | No tags attached. | ||||
| Bug heat | 8 | ||||
| Complete LimeSurvey version number (& build) | 6.16.12+26030 | ||||
| I will donate to the project if issue is resolved | No | ||||
| Browser | |||||
| Database type & version | - | ||||
| Server OS (if known) | |||||
| Webserver software & version (if known) | |||||
| PHP Version | 8.3 | ||||
| Git branch / Pull Request URL | |||||
|
PR created: https://github.com/LimeSurvey/LimeSurvey/pull/4771 |
|
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=40346 |
|
|
We reverted the commit. |
|
|
@c_schmitz Indeed, unable to reproduce this in v7 so I guess all good as far as this bug goes. Now.. the issue only APPEARS to be gone due to the changes made in https://github.com/LimeSurvey/LimeSurvey/pull/4801. But the underlying bugs discovered in my PR are still there, as far as I can tell. On the second call to createTable, the exception is simply ignored due to the try/catch block introduced in c543dd01ecd7b9a646389fde0fa9ed50429858c2 (CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'final_tokens_611668' already exists. The SQL statement executed was: CREATE TABLE |
|
|
@riku can you please test the changes from this commit https://github.com/LimeSurvey/LimeSurvey/commit/3006466993d2f6727b53855108e5e832753a0448 |
|
|
Fixed in Release 7.1.2+260917 |
|
|
Yeah seems fine. But the related bugs (including the logic in ImportResponsesTest) are still ignored, might come back to haunt later. The same fix should be applied for SurveyActivator::createResponseTable(). |
|
|
LimeSurvey: master f495b58b 2026-09-15 16:45 Richard Aljaste Committer: GitHub Details Diff |
Fixed issue 20457: tableExists helper function returns outdated result due to cache. (04771) |
Affected Issues 20457 |
|
| mod - application/helpers/admin/import_helper.php | Diff File | ||
| mod - application/helpers/common_helper.php | Diff File | ||
| mod - application/models/services/SurveyDeactivate.php | Diff File | ||
| mod - tests/functional/backend/ImportResponsesTest.php | Diff File | ||
|
LimeSurvey: master f9c5fb4c 2026-09-15 17:08 Details Diff |
Revert "Fixed issue 20457: tableExists helper function returns outdated result due to cache. (04771)" This reverts commit f495b58baf0dcd2d851b0f57b98ed7068f604ff3. |
Affected Issues 20457 |
|
| mod - application/helpers/admin/import_helper.php | Diff File | ||
| mod - application/helpers/common_helper.php | Diff File | ||
| mod - application/models/services/SurveyDeactivate.php | Diff File | ||
| mod - tests/functional/backend/ImportResponsesTest.php | Diff File | ||
| 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 |
| 2026-03-18 12:18 | c_schmitz | Assigned To | => c_schmitz |
| 2026-03-18 12:18 | c_schmitz | Status | new => in code review |
| 2026-09-15 16:46 | eusweisker | Status | in code review => resolved |
| 2026-09-15 16:46 | eusweisker | Resolution | open => fixed |
| 2026-09-15 17:02 | Changeset attached | => LimeSurvey master f495b58b | |
| 2026-09-15 17:02 | guest | Note Added: 85760 | |
| 2026-09-15 17:03 | guest | Bug heat | 2 => 4 |
| 2026-09-15 17:11 | c_schmitz | Status | resolved => feedback |
| 2026-09-15 17:11 | c_schmitz | Resolution | fixed => reopened |
| 2026-09-15 17:11 | c_schmitz | Note Added: 85761 | |
| 2026-09-15 17:11 | c_schmitz | Bug heat | 4 => 6 |
| 2026-09-15 17:38 | eusweisker | Changeset attached | => LimeSurvey master f9c5fb4c |
| 2026-09-15 17:38 | eusweisker | Assigned To | c_schmitz => eusweisker |
| 2026-09-15 17:38 | eusweisker | Status | feedback => resolved |
| 2026-09-15 17:38 | eusweisker | Resolution | reopened => fixed |
| 2026-09-15 17:38 | eusweisker | Bug heat | 6 => 8 |
| 2026-09-15 17:42 | c_schmitz | Assigned To | eusweisker => |
| 2026-09-15 17:42 | c_schmitz | Status | resolved => feedback |
| 2026-09-15 17:42 | c_schmitz | Resolution | fixed => reopened |
| 2026-09-16 00:57 | c_schmitz | Bug heat | 8 => 6 |
| 2026-09-16 09:47 | riku | Note Added: 85784 | |
| 2026-09-16 09:47 | riku | Status | feedback => new |
| 2026-09-16 16:17 | c_schmitz | Note Added: 85793 | |
| 2026-09-16 16:17 | c_schmitz | Assigned To | => c_schmitz |
| 2026-09-16 16:17 | c_schmitz | Status | new => feedback |
| 2026-09-17 13:12 | LimeBot | Note Added: 85809 | |
| 2026-09-17 13:12 | LimeBot | Status | feedback => closed |
| 2026-09-17 13:12 | LimeBot | Resolution | reopened => fixed |
| 2026-09-17 13:12 | LimeBot | Bug heat | 6 => 8 |
| 2026-09-17 14:29 | riku | Note Added: 85824 |