Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes two minor PHP undefined value issues reported in issues #71 and #72. The first fix prevents an "Undefined constant USERID" error that occurs in certain REDCap contexts when calling getBranchingFields. The second fix prevents a "TypeError: array_keys()" error when accessing potentially undefined array keys in the project events structure.
Changes:
- Added a guard to define the USERID constant as NULL when it's not already defined, preventing errors in getBranchingFields calls
- Added null coalescing operator to safely handle potentially undefined events array structure
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) { | ||
| if (!defined("USERID")) { | ||
| // prevents potential undefined constant issues in getBranchingFields | ||
| define("USERID", NULL); |
There was a problem hiding this comment.
Inconsistent indentation: this line uses 3 spaces instead of 4 spaces like the rest of the code. The define statement should be indented with 20 spaces (or 5 levels of 4-space indentation) to align with the comment above it.
| define("USERID", NULL); | |
| define("USERID", NULL); |
I couldn't recreate either of these, but they were trivial to fix.
ef0f224 closes #71
1a4e3d2 closes #72