View Issue Details

This issue affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
18475Bug reportsPluginspublic2026-10-26 17:53
ReporterDenisChenu Assigned Toc_schmitz  
PrioritynoneSeverityminor 
Status resolvedResolutionfixed 
Product Version5.4.x 
Summary18475: Multiple event newQuestionAttributes happen
Description

I you have a plugin with newQuestionAttributes : it happen for each quetsion loaded (and $this->event->get('questionAttributes')

Steps To Reproduce

Steps to reproduce

Import addScriptToQuestion plugin (dev version) https://gitlab.com/SondagesPro/QuestionSettingsType/addScriptToQuestion/-/tree/dev_LSissue
Activate
Set debug to 1
Preview survey
See result
Compare with 3.X

Expected result

Event happen one time (since it's needed only one time)

Actual result

Happen a lot of time

TagsNo tags attached.
Attached Files
3X_1times.png (135,021 bytes)
5X_122times.png (33,010 bytes)   
5X_122times.png (33,010 bytes)   
Bug heat4
Complete LimeSurvey version number (& build)5.4.9
I will donate to the project if issue is resolvedNo
Browsernot relevant
Database type & versionnot relevant
Server OS (if known)not relevant
Webserver software & version (if known)not relevant
PHP Versionnot relevant
Git branch / Pull Request URLN/A

Relationships

related to 19591 new Bug reports Multiple call of question_attribute for single question (public surey) 

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2022-11-09 10:30

developer   ~72651

In 3.X : core + plugin was set in a static array
In 5. core + plugin are not in static array

Unsure about QuetsinTheme :
maybe

  • core in static
  • newQuestionAttributes event : plugin in static
  • QuestionTheme update static array

And a new feature with newQuestionThemeAttributes but think we don't really need it

DenisChenu

DenisChenu

2022-11-09 11:28

developer   ~72652

Unsure related : Get : Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in E:\WebSite\limesurvey\application\models\services\QuestionAttributeHelper.php on line 35 Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 81920 bytes) in E:\WebSite\limesurvey\third_party\yiisoft\yii\framework\logging\CLogger.php on line 15

I deactivate all plugins and try to import again

DenisChenu

DenisChenu

2024-03-12 18:39

developer   ~79782

Happen 28 times with 4 questions

DenisChenu

DenisChenu

2024-06-07 12:08

developer   ~80256

Remind : one time for 3.X

c_schmitz

c_schmitz

2026-10-26 17:53

administrator   ~86873

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

Related Changesets

LimeSurvey: master 04019bc8

2026-10-26 17:51

c_schmitz


Details Diff
Fixed issue 18475: Plugins adding question settings were run again for every question shown, slowing down survey and admin pages
Dev The newQuestionAttributes event is dispatched once per request, and again only when its subscriptions change (new PluginManager::getSubscriptions()); PluginQuestionAttributeProvider uses QuestionAttribute::getOwnQuestionAttributesViaPlugin() instead of its own dispatch
Affected Issues
18475
mod - application/libraries/PluginManager/PluginManager.php Diff File
mod - application/models/QuestionAttribute.php Diff File
mod - application/models/services/PluginQuestionAttributeProvider.php Diff File
mod - tests/data/plugins/NewQuestionAttributesPlugin.php Diff File
mod - tests/unit/models/QuestionAttributeTest.php Diff File

Issue History

Date Modified Username Field Change
2022-11-09 10:28 DenisChenu New Issue
2022-11-09 10:28 DenisChenu File Added: 3X_1times.png
2022-11-09 10:28 DenisChenu File Added: 5X_122times.png
2022-11-09 10:30 DenisChenu Note Added: 72651
2022-11-09 10:30 DenisChenu Bug heat 0 => 2
2022-11-09 11:28 DenisChenu Note Added: 72652
2024-03-12 18:39 DenisChenu Note Added: 79782
2024-06-07 12:08 DenisChenu Relationship added related to 19591
2024-06-07 12:08 DenisChenu Note Added: 80256
2026-10-26 17:53 c_schmitz Changeset attached => LimeSurvey master 04019bc8
2026-10-26 17:53 c_schmitz Note Added: 86873
2026-10-26 17:53 c_schmitz Assigned To => c_schmitz
2026-10-26 17:53 c_schmitz Status new => resolved
2026-10-26 17:53 c_schmitz Resolution open => fixed
2026-10-26 17:53 c_schmitz Bug heat 2 => 4