session() errors
-
Hi, your restore_boot() function is called on just every load action in frontend, backend, ajax-calls. the simple session_start() line throws thousands of “session_start() will be ignored …” error log entries, if i try to start a session too in my coding.
Could you please wrap your session_start just in an if-condition?
if(session_status() === PHP_SESSION_NONE) {
session_start(); // phpcs:ignore
}I do so on my session_start, but somehow your session_start is not recognized as an active session, when i do my call. so my own if condition does not work.
And by the way. Why is the function executed all the time. Isn’t it just necessary, if i want to do a backwpup restore?
(Without checking by myself, if correct) ChatGPT suggests something like this for your session_start:
if (is_admin() || (defined(‘DOING_AJAX’) && isset($_REQUEST[‘action’]) && $_REQUEST[‘action’] === ‘restore’)) {
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start(); // phpcs:ignore
}
}
- You must be logged in to reply to this topic.