wp_cron.php SEEMS to be the source of headers being sent prematurely?
-
Posting here for a first evaluation, to see if I’m barking up the wrong tree.
I have a couple of plugins that are returning Header warnings that seem to be from wp_cron.php. These occur everytime the pages are accessed. So the logs get large very quickly.
I’m getting this in my logs:
Warning: Cannot modify header information – headers already sent by (output started at /home/nzin2020/dev.nzin2020.nz/wp-cron.php:23) in /home/nzin2020/dev.nzin2020.nz/wp-content/plugins/google-apps-login/core/core_google_apps_login.php on line 452
Warning: Cannot modify header information – headers already sent by (output started at /home/nzin2020/dev.nzin2020.nz/wp-cron.php:23) in /home/nzin2020/dev.nzin2020.nz/wp-content/plugins/wpfront-notification-bar/classes/class-wpfront-notification-bar.php on line 63
I have posted to the plugins in question and predictably they say it’s not their problem.
The error actually seems to think the problem comes from wp_cron.php at line 23
fastcgi_finish_request();
If I comment out that line, then the header problem goes away. So it seems to be an interaction with fast cgi and headers…
Although my understanding is that wp_cron.php should NOT be being called by plugins? Is that correct?
I have checked for rogue spacing in wp_cron.php, and functions.php and it doesn’t exist. If I call wp_cron.php directly, there appears to be absolutely no data returned.
I kept reading around and found an article that talked about session_write_close();
And that was also mentioned in the PHP page for fastcgi_finish_request();
So I added it to wp_cron.php, before fastcgi_finish_request();
So that particular section, from lines 21 to 25 now looks like this:
/* Don't make the request block till we finish, if possible. */ if ( function_exists( 'fastcgi_finish_request' ) && version_compare( phpversion(), '7.0.16', '>=' ) ) { session_write_close(); fastcgi_finish_request(); }
And that also seems to have stopped the warnings appearing. Well, at least as frequently. I’m still investigating, but it appears that those warnings do still appear every 40 minutes or so. Even though I can’t find a cron job that would be doing that.
But have I broken something else?
Is this something I should pass on as a bug?
Thanks
- The topic ‘wp_cron.php SEEMS to be the source of headers being sent prematurely?’ is closed to new replies.