AndrewPoppe / REDCap-PRO

REDCapPRO is an external module for REDCap that enables Patient Reported Outcomes in a manner that complies with regulatory stipulations.
GNU General Public License v3.0
4 stars 4 forks source link

no DAGs set causes TypeError exception in array_keys #94

Closed dheskettmgb closed 1 year ago

dheskettmgb commented 1 year ago

src/enroll.php

when getProjectDags() returns false (in REDCap::getGroupNames, if (empty($groups)) return false;), the array_keys will give an exception and crash: TypeError: array_keys(): Argument #1 ($array) must be of type array, bool given in modules/redcap_pro_v2.1.1/src/enroll.php:57

if ( (!empty($redcap_dag) && $dag !== $redcap_dag) || !in_array($dag, array_keys($dagHelper->getProjectDags())) ) {

fix, using a typecast...? probably not really the best fix, it works. better probably would be check for false and adjust the logic. if ( (!empty($redcap_dag) && $dag !== $redcap_dag) || !in_array($dag, array_keys((array)$dagHelper->getProjectDags())) ) {

AndrewPoppe commented 1 year ago

This should also be addressed in the bug fix version I submitted to the repo today (v2.1.2)

AndrewPoppe commented 1 year ago

Bug fixed in v2.1.2 (accepted to REDCap Repo)