uwctri / AddValidationTypes

REDCap EM to add and remove system wide validation types
GNU General Public License v3.0
1 stars 0 forks source link

Uncaught TypeError: Illegal offset type in #1

Closed tcranston closed 1 year ago

tcranston commented 1 year ago

First thanks for the module - looks really useful. However I'm getting an error when I try and add validation. I've been trying to at e164 phone format validation but it happen trying [1-9].

Any thoughts? - Again many thanks

Mobile Phone e164 format mobile_e164 +[1-9]\d{5,13} +[1-9]\d{5,13} text Not case sensitive

`Fatal error: Uncaught TypeError: Illegal offset type in /var/app/current/redcap/modules/add_validation_types_v1.0.2/AddValidationTypes.php:109 Stack trace:

0 [internal function]: UWMadison\AddValidationTypes\AddValidationTypes->UWMadison\AddValidationTypes{closure}()

1 /var/app/current/redcap/modules/add_validation_types_v1.0.2/AddValidationTypes.php(108): array_map()

2 /var/app/current/redcap/modules/add_validation_types_v1.0.2/AddValidationTypes.php(35): UWMadison\AddValidationTypes\AddValidationTypes->addType()

3 /var/app/current/redcap/modules/add_validation_types_v1.0.2/router.php(4): UWMadison\AddValidationTypes\AddValidationTypes->process()

4 /var/app/current/redcap/redcap_v12.4.15/ExternalModules/index.php(126): require('...')

5 {main}

thrown in /var/app/current/redcap/modules/add_validation_types_v1.0.2/AddValidationTypes.php on line 109

REDCap crashed due to an unexpected PHP fatal error!

Error message: Uncaught TypeError: Illegal offset type in modules/add_validation_types_v1.0.2/AddValidationTypes.php:109 Stack trace: #0 [internal function]: UWMadison\AddValidationTypes\AddValidationTypes->UWMadison\AddValidationTypes\{closure}() #1 modules/add_validation_types_v1.0.2/AddValidationTypes.php(108): array_map() #2 modules/add_validation_types_v1.0.2/AddValidationTypes.php(35): UWMadison\AddValidationTypes\AddValidationTypes->addType() #3 modules/add_validation_types_v1.0.2/router.php(4): UWMadison\AddValidationTypes\AddValidationTypes->process() #4 redcap_v12.4.15/ExternalModules/index.php(126): require('...') #5 {main} thrown
File: modules/add_validation_types_v1.0.2/AddValidationTypes.php
Line: 109
` `Uncaught TypeError: Cannot read properties of undefined (reading 'length') at Object.success (main.js?1665800898:203:33) at l (bundle.js?1662116934:223:24450) at Object.fireWith [as resolveWith] (bundle.js?1662116934:223:25198) at T (bundle.js?1662116934:223:76153) at XMLHttpRequest. (bundle.js?1662116934:223:78621)` ![image](https://user-images.githubusercontent.com/7591038/200890685-63a136fb-b782-462f-a1c4-97b522ec1a35.png) ![image](https://user-images.githubusercontent.com/7591038/200890850-692007b0-5fbf-42f0-a8f5-f83bff5c4559.png) ![image](https://user-images.githubusercontent.com/7591038/200893937-f0b01b27-adf0-4214-88b5-ec2a0ac4977a.png)
aanunez commented 1 year ago

Hello Tim!

Thanks for reporting this issue. Its unclear to me why this is throwing an error for you and not me, but regardless I've found the issue. On line 109 of the latest release I mistakenly forgot to loop over the array_keys.

Question for you: What version of redcap are you currently on? I'd like to include new features in the next release along with this bug fix, but redcap 12.5.9 is required for them.

tcranston commented 1 year ago

No problem and thank you for the prompt reply and fix Adam. Re version - currently REDCap 12.4.15 · PHP 8.1.9 (Linux/Unix OS) · MySQL 5.7.12 looking to upgrade shortly to 12.4.23 but stay of 12.4 LTS for a the study we are looking to use it in, (given validation effort etc we have put in 12.4...)

Don't know the effort needed to update/release to RC external module list, but if there was any scope for a fix for 12.4 that would be awesome. Either way appreciate the work and sharing with the community

aanunez commented 1 year ago

I just submitted a 12.4.1+ compatible version with the fix to Vanderbilt, it will probably be available tomorrow in the repo. I'll wait until you are able to verify that this resolves the issue.

tcranston commented 1 year ago

Thank you, picked that up this afternoon (GMT) initial test seems fine, but only got a chance to briefly look. Will run through first thing tomorrow and then close. Again thanks - much appreciated

tcranston commented 1 year ago

Again thanks