BASE . LOG,
'file_id' => $LOG_FILE_ID,
// add file date
'print_file_date' => true,
// set debug and print flags
'debug_all' => $DEBUG_ALL ?? false,
'echo_all' => $ECHO_ALL ?? false,
'print_all' => $PRINT_ALL ?? false,
]);
use CoreLibs\Create\Session;
$PAGE_NAME = 'TEST CLASS: SESSION (READ)';
print "";
print "
" . $PAGE_NAME . "";
print "";
print '';
print '' . $PAGE_NAME . '
';
$session_name = 'class-test-session';
// $session_name = '';
$var = 'foo';
$value = 'bar';
echo "Global session name: " . ($GLOBALS['SET_SESSION_NAME'] ?? '-') . "
";
print "[UNSET] Current session id: " . Session::getSessionId() . "
";
print "[UNSET] Current session name: " . Session::getSessionName() . "
";
print "[UNSET] Current session active: " . (Session::checkActiveSession() ? 'Yes' : 'No') . "
";
print "[UNSET] Current session status: " . getSessionStatusString(Session::getSessionStatus()) . "
";
print "[READ] " . $var . ": " . ($_SESSION[$var] ?? '{UNSET}') . "
";
// start
if (false === ($session = Session::startSession($session_name))) {
print "Session start failed: " . Session::getErrorStr() . "
";
} else {
print "Current session id: " . $session . "
";
}
// set again
if (false === ($session = Session::startSession($session_name))) {
print "[2] Session start failed
";
} else {
print "[2] Current session id: " . $session . "
";
}
print "[SET] Current session id: " . Session::getSessionId() . "
";
print "[SET] Current session name: " . Session::getSessionName() . "
";
print "[SET] Current session active: " . (Session::checkActiveSession() ? 'Yes' : 'No') . "
";
print "[SET] Current session status: " . getSessionStatusString(Session::getSessionStatus()) . "
";
print "[READ] " . $var . ": " . ($_SESSION[$var] ?? '{UNSET}') . "
";
print "[READ] Confirm " . $var . " is " . $value . ": "
. (($_SESSION[$var] ?? '') == $value ? 'Matching' : 'Not matching') . "
";
print "[ALL SESSION]: " . \CoreLibs\Debug\Support::printAr($_SESSION) . "
";
// error message
print $log->printErrorMsg();
print "";
// __END__