peachpie
peachpie copied to clipboard
can not access the session variable if the session is not auto start.
If the session is not set auto start at:
class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddPhp(options =>
{
//options.Session.AutoStart = true; //<==
});
Although I call session_start() before access session variable like this:
//php
session_start();
$_SESSION['count']=0; // throw error here
It throw error > System.NullReferenceException: Object reference not set to an instance of an object.
I have not found this error for v1.1.0 ,v1.1.1 but found this error for v1.1.2, v1.1.3 I use net5.0
thank you for reporting the issue;
This may happen if there are headers sent before calling session_start(). Isn't there anything in the debug log?
also; please check what is the return value of session_start() - it's probably returning false with some additional details in debug output.