Skip to content

[redcap] redcap2linst tool, generated LINST instrument terminal {-@-} crash #10663

Description

@regisoc

Describe the bug
The {-@-} added in all redcap instruments makes the instrument_LINST class crash, as it tries to interpret the final line as another field.

Here is the log:

[CRITICAL] /var/www/Loris/php/libraries/NDB_BVL_Instrument_LINST.class.inc:404: Uncaught TypeError: strpos(): Argument #1 ($haystack) must be of type string, null given in /var/www/Loris/php/libraries/NDB_BVL_Instrument_LINST.class.inc:404
Stack trace:
#0 /var/www/Loris/php/libraries/NDB_BVL_Instrument_LINST.class.inc(404): strpos()
#1 /var/www/Loris/php/libraries/NDB_BVL_Instrument.class.inc(308): Loris\\Behavioural\
DB_BVL_Instrument_LINST->loadInstrumentFile()
#2 /var/www/Loris/modules/instruments/php/instrumentqueryengine.class.inc(58): NDB_BVL_Instrument::factory()
#3 /var/www/Loris/modules/dataquery/php/query.class.inc(409): LORIS\\instruments\\InstrumentQueryEngine->getDataDictionary()
#4 /var/www/Loris/modules/dataquery/php/query.class.inc(458): LORIS\\dataquery\\Query->_populateModuleDictCache()
#5 /var/www/Loris/modules/dataquery/php/query.class.inc(174): LORIS\\dataquery\\Query->getFields()
#6 /var/www/Loris/src/Data/Filters/AccessibleResourceFilter.php(47): LORIS\\dataquery\\Query->isAccessibleBy()
#7 /var/www/Loris/src/Data/ProvisionerInstance.php(130): LORIS\\Data\\Filters\\AccessibleResourceFilter->filter()
#8 [internal function]: LORIS\\Data\\ProvisionerInstance->{closure:LORIS\\Data\\ProvisionerInstance::execute():129}()
#9 [internal function]: CallbackFilterIterator->accept()
#10 /var/www/Loris/modules/dataquery/php/module.class.inc(107): FilterIterator->next()
#11 /var/www/Loris/modules/dashboard/php/dashboard.class.inc(89): LORIS\\dataquery\\Module->getWidgets()
#12 /var/www/Loris/php/libraries/Module.class.inc(224): LORIS\\dashboard\\Dashboard->__construct()
#13 /var/www/Loris/php/libraries/Module.class.inc(307): Module->loadPage()
#14 /var/www/Loris/src/Middleware/ResponseGenerator.php(51): Module->handle()
#15 /var/www/Loris/src/Middleware/AuthMiddleware.php(64): LORIS\\Middleware\\ResponseGenerator->process()
#16 /var/www/Loris/src/Router/ModuleRouter.php(75): LORIS\\Middleware\\AuthMiddleware->process()
#17 /var/www/Loris/src/Middleware/ExceptionHandlingMiddleware.php(55): LORIS\\Router\\ModuleRouter->handle()
#18 /var/www/Loris/src/Router/BaseRouter.php(160): LORIS\\Middleware\\ExceptionHandlingMiddleware->process()
#19 /var/www/Loris/src/Middleware/ResponseGenerator.php(51): LORIS\\Router\\BaseRouter->handle()
#20 /var/www/Loris/src/Middleware/MFA.php(46): LORIS\\Middleware\\ResponseGenerator->process()
#21 /var/www/Loris/src/Middleware/RedirectControl.php(36): LORIS\\Middleware\\MFA->process()
#22 /var/www/Loris/src/Middleware/ContentSecurityPolicy.php(57): LORIS\\Middleware\\RedirectControl->process()
#23 /var/www/Loris/src/Middleware/AWS.php(35): LORIS\\Middleware\\ContentSecurityPolicy->process()
#24 /var/www/Loris/src/Middleware/ContentLength.php(53): LORIS\\Middleware\\AWS->process()
#25 /var/www/Loris/src/Middleware/LorisMenu.php(34): LORIS\\Middleware\\ContentLength->process()
#26 /var/www/Loris/src/Middleware/ContentLength.php(53): LORIS\\Middleware\\LorisMenu->process()
#27 /var/www/Loris/src/Middleware/Language.php(141): LORIS\\Middleware\\ContentLength->process()
#28 /var/www/Loris/src/Middleware/RequestAttributeBuilder.php(60): LORIS\\Middleware\\Language->process()
#29 /var/www/Loris/htdocs/index.php(96): LORIS\\Middleware\\RequestAttributeBuilder->process()
#30 {main}
  thrown, referer: https://test-dev-270.loris.ca/999999

Other instruments like bmi and eeg_acquisition_form not having {-@-} tag are not triggering this error.
Removing the tag from the instrument solves the issue, but there will be an interaction with/change to apply to the data dictionary builder tool.

To Reproduce
Steps to reproduce the behavior (attach screenshots if applicable):

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

What did you expect to happen?
A clear and concise description of what you expected to happen.

Browser Environment (please complete the following information):

  • OS: [e.g. Plan9, HURD, Oberon, etc]
  • Browser [e.g. chrome, firefox] (note that only these two browsers are supported)
  • Version [e.g. 22]

Server Environment (if known):
Note: We only support the most recent release of LORIS.

  • LORIS Version: [e.g. 22.0.0]
  • Linux distribution and Version: [e.g. Ubuntu 16.04, CentOS 7]
  • MySQL/MariaDB Version: [e.g. MySQL 5.7, MariaDB 10.3]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

29.0.0 - BugsIssues found during the release testing for 29.0.0Area: InstrumentsPR or issue related instrumentsCategory: BugPR or issue that aims to report or fix a bugLanguage: PHPPR or issue that update PHP codeModule: redcapPR or issue related to redcap modulePriority: HighPR or issue should be prioritised over others for review and testing

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions