In my project I get this error:
Access to undeclared static property.
The code apparently is correct:
<?php
class Session {
private static $sessionStarted = false;
public static function init()
{
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
if (session_status() === PHP_SESSION_ACTIVE) {
self::$sessionStarted = true; // <-- this line causes the error!!!
}
}
My environment: Windows 10, Windows Bash and Docker php:5.6-apache