Notifications
Clear all

wpForo 1.x.x [Solved] PHP Warning: session_start(): Cannot start session when headers already sent

7 Posts
4 Users
1 Reactions
4,173 Views
Posts: 6
Topic starter
(@sifuhall)
Active Member
Joined: 4 years ago

My logs are filled with this warning:

PHP Warning: session_start(): Cannot start session when headers already sent in /wp-content/plugins/wpforo/wpf-includes/class-notices.php on line 16

I have disabled all plugins except:

wpForo

wpForo - Blog Cross Posting

wpForo Embeds

wpForo Emoticons

 

And the error still occurs.  I can reproduce the error by clicking the wpForo Delete All Caches button.

6 Replies
Posts: 992
Moderator
(@martin)
Support Team
Joined: 8 years ago

Hi @sifuhall

This error says that wpForo doesn't have any PHP error. Your output is affected by other plugin error and it generates " headers already sent " NOTICE in wpForo functions. It'll generates such notices in all plugins who have session functions. So please find the plugin who generates errors or outputs in header. Deactivate those one by one and check, once the wpForo Notice is gone then the problem is fixed and you found the problem maker plugin.

This error also can be from functions.php of your theme.

Another explanation:  https://wordpress.org/support/topic/php-warning-in-cron-daemon/#post-12238846

5 Replies
(@sifuhall)
Joined: 4 years ago

Active Member
Posts: 6

@martin

Thank you for the reply.

As I stated I have disabled all plugins except:

wpForo

wpForo - Blog Cross Posting

wpForo Embeds

wpForo Emoticons

 

 

I will try disabling extra wpforo plugins as well.  

My theme is divi so I will try switching to the default theme.

Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1862

@sifuhall,

Try to disable the add-on as well and check again.

My theme is divi so I will try switching to the default theme.

Yes, please keep us informed.

copilot
(@copilot)
Joined: 6 years ago

Eminent Member
Posts: 26

Hi @martin @alvina,

I am experiencing the same PHP error. Disabling all plugins except wpforo does not solve it. I have not changed any plugin files myself.

This is the error I get:

PHP Warning: session_start(): Cannot start session when headers already sent in /var/www/aeroea-kulinichi/wordpress/current/wp-content/plugins/wpforo/wpf-includes/class-notices.php on line 16

Looking into file [wpforo/wpf-includes/class-notices.php] and comparing it with an older wpforo copy at GitHub [ https://github.com/DediData/wpforo/blob/master/wpf-includes/class-notices.php ] there is one thing that makes me wonder if that could be something.

In my installation I see:

/**
* @return void
*/
private function init(){
if( !wpforo_is_session_started() && ( !is_admin() || (!empty($_GET['page']) && strpos($_GET['page'], 'wpforo-') !== false ) || (wpforo_is_ajax() && !empty($_POST['action']) && false !== strpos($_POST['action'], 'wpforo')) )) session_start();
}

But at GitHub its much shorter:

 /**
* @return void
*/
private function init(){
if(!wpforo_is_session_started()) session_start();
}

 

Could this be something?

 

Thanks!

Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1862

@copilot,

This will be fixed in the next version of the plugin update.

Besides, Please note the wpForo refused the session and does not use it at all.

copilot
(@copilot)
Joined: 6 years ago

Eminent Member
Posts: 26

Hi @alvina,

Thank you for taking care! I understand that the error isn't affecting performance. It's only that our debug.log fills rather quickly with this error being printed on every page load.

Thanks!