session header bug “Session cannot be started” continues on cron
-
Hello, the following error is still not resolved for php7.4
NOTICE: PHP message: PHP Warning: session_start(): Session cannot be started after headers have already been sent in /var/www/html/wp-content/plugins/user-blocker/includes/user_blocker_common_functions.php on line 510
note this is affecting cron jobs and therefore other plugins that need cron.
this has been reported for two years
the code in question looks at a constant regarding headers.
function ublk_session_start() {
if(session_status()!=PHP_SESSION_ACTIVE) {
session_start([‘read_and_close’ => true]);
}
}`noted here
https://www.php.net/manual/en/function.session-status.php
Note session_status() is for file based session only.
DB based session status needs to have custom function based on table structure.also != should probably be !==
however this method PHP function headers_sent() may work better
https://www.php.net/manual/en/function.headers-sent.phpPerhaps it is attached to the wrong action, see here
https://www.ironistic.com/insights/using-php-sessions-in-wordpress/
- The topic ‘session header bug “Session cannot be started” continues on cron’ is closed to new replies.