peachpiecompiler / peachpie

PeachPie - the PHP compiler and runtime for .NET and .NET Core
https://www.peachpie.io
Apache License 2.0
2.31k stars 202 forks source link

accessing $_SESSION without starting session #1017

Closed jakubmisek closed 2 years ago

jakubmisek commented 2 years ago

$_SESSION may be NULL as expected, but the following will cause the program to crash:

<?php
echo $_SESSION['xxx']; // throws NullReferenceException

The compiler does not expect that $_SESSION can be null and emits code that causes NullReferenceException