Skip to content

Minor fixes for undefined values#74

Open
ChemiKyle wants to merge 2 commits intoctsit:developfrom
ChemiKyle:minor_fixes_2026_02_10
Open

Minor fixes for undefined values#74
ChemiKyle wants to merge 2 commits intoctsit:developfrom
ChemiKyle:minor_fixes_2026_02_10

Conversation

@ChemiKyle
Copy link
Contributor

@ChemiKyle ChemiKyle commented Feb 10, 2026

I couldn't recreate either of these, but they were trivial to fix.
ef0f224 closes #71
1a4e3d2 closes #72

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
define("USERID", NULL);
define("USERID", NULL);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant