Repository navigation
fix(backend): undefined variables and PS7 ? parsing slips - #914
Merged
KelvinTegelaar merged 1 commit intoOct 15, 2026
Merged
Conversation
- "$Var?" in strings and $Var?.Prop parse as a variable named "Var?" in PS7 (always empty):
ExecBECRemediate username lookup, OneDrive root permissions owner lookup, Compare-CIPPIntuneObject labels (11 sites)
- Get-CIPPAlertTERRL: -severity is not a Write-LogMessage parameter (-sev)
- Get-CIPPAlertNewMFADevice: ${$IPAddress} -> ${IPAddress}
- ExecSetMailboxQuota: quota was overwritten by the EXO result between branches; message used an undefined $message
- log calls referencing undefined variables ($User, $Tenant, $IntuneBody, $Displayname, $AppDetails, $APIName,
$ErrorMessage, $GUID, $Request in non-HTTP functions, $name, $tenantfilter, $InstanceId, $Message)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Variables that are used but never assigned in scope, found with an AST sweep.
Behaviour bugs
?is a legal variable-name character. So"…/users/$SuspectUser?$select=…"reads$SuspectUser?, which is empty, and$obj?.displayNamereads$obj?`, which is always null.Compare-CIPPIntuneObject: labels always fell back to the setting ID.$($x)?and${x}?..Get-CIPPAlertTERRL: calledWrite-LogMessage -severity, which doesn't exist, so the catch block threw instead of logging.ExecSetMailboxQuota:$quota = New-ExoRequest …overwrote the requested quota. Setting several quota types at once sent the previous EXO result as the next quota.Log-only fixes
About 15 log calls passed undefined variables, leaving the user, tenant or name empty. Each now uses the variable that is actually in scope.
Testing
"$a?"gives an empty string and${a}?.breturns the value.