Steps to reproduce
Set-Content -Value $null -Path .\zero.txt -NoNewline -Encoding Ascii
(get-item .\zero.txt).Length -eq 0 # returns $true
$content = gc .\zero.txt -Raw -Encoding Ascii
$content -eq $null # returns $true
$null -eq $content # returns $true
$content -match 'anything' # returns nothing, but should return $false
[System.Management.Automation.Internal.AutomationNull]::Value -match 'anything' # ditto
$null -match 'anything' # returns $false
Expected behavior
$true
$true
$true
$false
$false
$false
Actual behavior
$true
$true
$true
# returns nothing at all
# returns nothing at all
$false
Impact
This makes it more difficult to write scripts that process content in files, because tests that should fail return nothing instead, so if you were checking for a failure and then jumping to the next iteration of the loop with continue, your continue does not get called and then unpredictable things can happen as a result.
Environment data
Reproduced in PowerShell 5.1 and 6.0.
Steps to reproduce
Expected behavior
Actual behavior
Impact
This makes it more difficult to write scripts that process content in files, because tests that should fail return nothing instead, so if you were checking for a failure and then jumping to the next iteration of the loop with continue, your continue does not get called and then unpredictable things can happen as a result.
Environment data
Reproduced in PowerShell 5.1 and 6.0.