Session warning | WordPress.org

[ad_1]

Glad to help. I’m not seeing any errors on default WordPress. So it could be something specific to the site. If you let me know the steps to repeat the error, I will investigate asap.

I would hazard a guess it is happening inside cron call, I read somewhere that current php you can not use reliably(line 25);

if (php_sapi_name() !== 'cli') {

trying to find the explanation, will post when/if found

Interesting. Which version of PHP are you using?

v8.2 … it is not cli as that was there when I did it from command line as a test.

It is hitting this warning every cron call, which is invoked as;

*/15 * * * * wget --delete-after https://jenolan.org/wp-cron.php >/dev/null 2>&1

Just ran it manually and it threw the warning hmmmm I will add some code to your function to see if I can work out why it is triggering 😉

Yeah we develop on 8/8.1 primarily. But want to prepare for 8.2 as well. Looking forward to your findings 🙂

Fixed, at the top of wp-cron.php it is sending headers which then causes the session setting to fail….

<?php // Simple Ajax Chat > Chat Form

if (!defined('ABSPATH')) exit;

if (sac_is_session_started() === false) {
	if( defined( 'DOING_CRON' ) AND DOING_CRON === TRUE )
	{
		return;
	}
	
	if (session_status() === PHP_SESSION_NONE) {
		
		$simple_ajax_chat_domain = (isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) ? sanitize_text_field($_SERVER['HTTP_HOST']) : null;
		
		if ($simple_ajax_chat_domain) {
			session_set_cookie_params('21600', '/', $simple_ajax_chat_domain, false, true);
			
			session_start(array('read_and_close' => true));
			
		}
		
	}
	
}

Ah ok, yes that makes sense. I will add a cron check as described for the next plugin update. Thank you very much for your help, Larry. Feel free to post again with any further/related infos.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer