Forum Replies Created

Viewing 14 replies - 16 through 29 (of 29 total)
  • Thread Starter glouton

    (@glouton)

    Hi there,

    On the same clean WordPress with my dummy Minutely event plugin, I’ve removed the previous WP Cerber and installed this 8.5.4 one.

    No more “header already sent” in log indeed.

    Thanks for fix.

    Thread Starter glouton

    (@glouton)

    So there was something.

    Thanks for the fix, I’ll test it asap.

    Thread Starter glouton

    (@glouton)

    Sorry, forgot the dummy-cron.php

    <?php
    /**
     * Plugin Name: Dummy Cron
     */
    function my_add_minutely( $schedules ) {
        // add a 'minutely' schedule to the existing set
        $schedules['minutely'] = array(
            'interval' => 60,
            'display' => __('Once Minutely')
        );
        return $schedules;
    }
    add_filter( 'cron_schedules', 'my_add_minutely' );
    
    register_activation_hook(__FILE__, 'my_activation');
    
    function my_activation() {
        if (! wp_next_scheduled ( 'my_minutely_event' )) {
            wp_schedule_event(time(), 'minutely', 'my_minutely_event');
        }
    }
    
    add_action('my_minutely_event', 'do_this_minutely');
    
    function do_this_minutely() {
        // do something every minute
        error_log( 'My minutely event.' );
    }
    
    register_deactivation_hook(__FILE__, 'my_deactivation');
    
    function my_deactivation() {
        wp_clear_scheduled_hook('my_minutely_event');
    }
    Thread Starter glouton

    (@glouton)

    Hello,

    That’s really weird!
    I launched the same test I ran for the others.

    • Start with a fresh install of WordPress 5.3
    • Install and activate WP Cerber
    • Install and activate my single file dummy cron plugin below

    See the result in the the attached log, tones of “headers already sent” after installing your plugin and then 4 every minute because of the cron.

    After the WordPress install I’ve check cron in the database, table wp_options with option_name = ‘cron’.
    There was only core tasks.
    Then I activated WP Cerber and had 2 warnings in log right after activation + WP Cerber cron tasks added on database.
    Then I activated my dummy cron which added to more warnings in log.

    >> The plugin works just fine on PHP 7.X except your case. Perhaps someone else came across the same issue but nobody has reported yet.

    I might be wrong but it really look like the plugin raises this warning when WordPress cron task runs. Which is a core functionnality.

    I running PHP 7.3.11 with Apache 2.4.6 and PHP-FPM under Centos 7.7

    PHP-FPM log file: https://mega.nz/#!YjYzwS5R!o-twJ8Wh6lUnIQv-wZnJJ1JBnn7UWiNw5S4kxKfVwzg
    WordPress Extensions: https://mega.nz/#!56BXDAZY!uKlJ7yEaARcG3u-hknMZm7Lgu3N2JkvpiO_jvug0dTM

    • This reply was modified 5 years, 3 months ago by glouton.
    Thread Starter glouton

    (@glouton)

    PS:

    I’ve installed WP Cerber locally and on test environment and have the warning on both.

    I haven’t deployed it to production yet, where I don’t have the warning.

    Thread Starter glouton

    (@glouton)

    Hello,

    Thank you for answering but I really think you’re wrong.

    I’ve had this with other plugins, explaining the authors i’ve checked and clean all the code, tested one clean WordPress install… etc..

    One has fixed his own code, CPB Poll:
    https://www.ads-software.com/support/topic/headers-already-sent-39/

    One kept pretending “it’s not us, it’s someone else”, Contact Form 7 Multi-Step Forms:
    https://www.ads-software.com/support/topic/hea/

    Former fixed the issue, later did nothing and message in log did indeed vanish after removing this extension.

    I know what can cause header already sent warning. But then again, didn’t have it before installing WP Cerber.

    And as I pointed here and for the other plugin authors, it’s because wp-cron.php calls fastcgi_finish_request() if you run PHP 7.0.16 >=, which sends headers.

    But that’s a WordPress core file. So it depends if you want you plugin to be compatible with WordPress and PHP >= 7 or not.

    Regards,

    Thread Starter glouton

    (@glouton)

    Hi,

    The empty first line is just a formatting thing when posting to the forum indeed.
    Of course I don’t have it in orignal code, set nobomb in Vim and checked for trailing white spaces with phptags.

    Furthermore let me remind you that I first had these warnings on a real project.
    I added this little cron-test only to confirm what I found after days of digging.

    Maybe you can’t reproduce because you did not enable WP_DEBUG and WP_DEBUG_LOG.
    If this is the case I suggest that you do. Simplest way is to copy paste the example at the bottom of this WordPess Codex page:

    Debugging in WordPress

    Thread Starter glouton

    (@glouton)

    (not saying hello as you never bothered)

    If by “the other developers” and “their plugin” you mean codeboxr, Sabuj Kundu and the CBX Poll plugin then yes indeed THEY looked into it and fixed THEIR plugin.

    You on the other hand didn’t fixed anything and plugin still face exactly the same issue.

    Again, as already said before, with only WordPress + CF7 + CF7 Multi-steps + my little plugin to run cron minutely and the warnings are having a party in the log.
    See install plugins in this screenshot:
    https://mega.nz/#!gm5RBITY!e1ul-bRC8Wb55O55b-u8M4gj2o2TrewE_WQv2YfMxXw

    I guess you can download their plugin and look at how they fixed it.
    I pointed you to the right direction telling you when and where it happens and even almost the why. It has something to do with PHP version >= 7.0
    From my original post “I’ve managed to narrow it down to wp-cron.php on line 23 with fastcgi_finish_request()”

    Here the log right now (again with only you plugin and a dummy cron task):

    
    [23-Sep-2019 07:54:58 UTC] PHP Warning:  Cannot modify header information - headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 106
    [23-Sep-2019 07:54:58 UTC] PHP Warning:  session_start(): Cannot start session when headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 110
    [23-Sep-2019 07:54:58 UTC] My minutely event.
    [23-Sep-2019 07:56:33 UTC] PHP Warning:  Cannot modify header information - headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 106
    [23-Sep-2019 07:56:33 UTC] PHP Warning:  session_start(): Cannot start session when headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 110
    [23-Sep-2019 07:56:33 UTC] My minutely event.
    [23-Sep-2019 08:01:41 UTC] PHP Warning:  Cannot modify header information - headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 106
    [23-Sep-2019 08:01:41 UTC] PHP Warning:  session_start(): Cannot start session when headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 110
    [23-Sep-2019 08:01:41 UTC] My minutely event.
    [23-Sep-2019 08:02:44 UTC] PHP Warning:  Cannot modify header information - headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 106
    [23-Sep-2019 08:02:44 UTC] PHP Warning:  session_start(): Cannot start session when headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 110
    [23-Sep-2019 08:02:44 UTC] My minutely event.
    [23-Sep-2019 08:04:44 UTC] PHP Warning:  Cannot modify header information - headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 106
    [23-Sep-2019 08:04:44 UTC] PHP Warning:  session_start(): Cannot start session when headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 110
    [23-Sep-2019 08:04:44 UTC] My minutely event.
    [23-Sep-2019 08:06:36 UTC] PHP Warning:  Cannot modify header information - headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 106
    [23-Sep-2019 08:06:36 UTC] PHP Warning:  session_start(): Cannot start session when headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 110
    [23-Sep-2019 08:06:36 UTC] My minutely event.
    [23-Sep-2019 08:07:36 UTC] PHP Warning:  Cannot modify header information - headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 106
    [23-Sep-2019 08:07:36 UTC] PHP Warning:  session_start(): Cannot start session when headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 110
    [23-Sep-2019 08:07:36 UTC] My minutely event.
    [23-Sep-2019 08:09:36 UTC] PHP Warning:  Cannot modify header information - headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 106
    [23-Sep-2019 08:09:36 UTC] PHP Warning:  session_start(): Cannot start session when headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 110
    [23-Sep-2019 08:09:36 UTC] My minutely event.
    [23-Sep-2019 08:11:36 UTC] PHP Warning:  Cannot modify header information - headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 106
    [23-Sep-2019 08:11:36 UTC] PHP Warning:  session_start(): Cannot start session when headers already sent in /Nightcrawler/projects/WordPress/www/wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php on line 110
    [23-Sep-2019 08:11:36 UTC] My minutely event.

    If you don’t want to fix it that’s not of my business, I have remove your plugin anyway and wasted way enough time with that.

    Thread Starter glouton

    (@glouton)

    Hi there,

    Thank you for this new version.

    It seems to fix the “header already sent” warning indeed.

    Regards,

    Thread Starter glouton

    (@glouton)

    Hi there,

    I think I just proved to you that on the contrary there is a problem with this plugin and that CBX Poll plugin has the same one.

    Your plugin does not run anything in WP Cron but it does issue the error in log when the cron runs. This is precisely what my test above shows.
    Means it’s hooked somewhere the wrong way because it’s called when the cron runs.

    Please read my answer carefully once more.

    basically, WP Cron runs > Your plugin tries to start session.

    This is wrong and shouldn’t happen.
    Your plugin does not have any issue as long as no WP Cron task runs.
    But there are cron task even in core WordPress. Cron task in WooCommerce and many other very famous plugins.
    As a result, your plugin seems flawed.

    I think I’ve already done a lot of work for you trying to narrow down the problem.
    The least you could do is address it and have a look into it.

    PS: if you check the support thread on CBX Poll side you’ll see that their answer to this issue is “We are checking, will give feedback asap.”

    Thread Starter glouton

    (@glouton)

    Thank you for that and may the Force be with You.

    Thread Starter glouton

    (@glouton)

    Hello,

    I was pretty sure I had ruled out all other possible causes but having same issue with another plugin I wanted to be on the safe side. Here’s what I’ve done :

    1. Install a fresh WordPress 5.2.3
    2. Install CBX Poll

    By the way I have open the same thread for Contact Form 7 Multi-step forms: https://www.ads-software.com/support/topic/hea/

    As I’ve previously managed to narrow it down to the WordPress schedule task system and their wp-cron.php file, I’ve quickly created a dummy plugin to register minutely task:

    
    <?php
    /**
     * Plugin Name: Cron Test
     */
    function my_add_minutely( $schedules ) {
        // add a 'minutely' schedule to the existing set
        $schedules['minutely'] = array(
            'interval' => 60,
            'display' => __('Once Minutely')
        );
        return $schedules;
    }
    add_filter( 'cron_schedules', 'my_add_minutely' );
    
    register_activation_hook(__FILE__, 'my_activation');
    
    function my_activation() {
        if (! wp_next_scheduled ( 'my_minutely_event' )) {
            wp_schedule_event(time(), 'minutely', 'my_minutely_event');
        }
    }
    
    add_action('my_minutely_event', 'do_this_minutely');
    
    function do_this_minutely() {
        // do something every minute
        error_log( 'My minutely event.' );
    }
    
    register_deactivation_hook(__FILE__, 'my_deactivation');
    
    function my_deactivation() {
            wp_clear_scheduled_hook('my_minutely_event');
    }
    

    And now I do have the PHP warning repeatedly:
    https://mega.nz/#!cvZEwChI!FPrpr9XTdrhMerRZ6KYKPYKEeYihyZQwWaghH8kJnCg

    Regards,

    Thread Starter glouton

    (@glouton)

    PS: wonder who marked this as resolved…

    Thread Starter glouton

    (@glouton)

    Hello,

    Thank you for getting back to me promptly.

    I was pretty sure I had ruled out all other possible causes but to be on the safe side here’s what I’ve done :

    1. Install a fresh WordPress 5.2.3
    2. Install CF7
    3. Install CF7 Multi-Step

    On this brand new installation I didn’t have any error.
    Then after installing and activating CBX Poll it came back once. By the way I have open the same thread on their side: https://www.ads-software.com/support/topic/headers-already-sent-39/

    As I’ve previously managed to narrow it down to the WordPress schedule task system and their wp-cron.php file, I’ve quickly created a dummy plugin to register minutely task:

    
    <?php
    /**
     * Plugin Name: Cron Test
     */
    function my_add_minutely( $schedules ) {
        // add a 'minutely' schedule to the existing set
        $schedules['minutely'] = array(
            'interval' => 60,
            'display' => __('Once Minutely')
        );
        return $schedules;
    }
    add_filter( 'cron_schedules', 'my_add_minutely' );
    
    register_activation_hook(__FILE__, 'my_activation');
    
    function my_activation() {
        if (! wp_next_scheduled ( 'my_minutely_event' )) {
            wp_schedule_event(time(), 'minutely', 'my_minutely_event');
        }
    }
    
    add_action('my_minutely_event', 'do_this_minutely');
    
    function do_this_minutely() {
        // do something every minute
        error_log( 'My minutely event.' );
    }
    
    register_deactivation_hook(__FILE__, 'my_deactivation');
    
    function my_deactivation() {
            wp_clear_scheduled_hook('my_minutely_event');
    }
    

    And now I do have the PHP warning repeatedly:
    https://mega.nz/#!FzwzyYQa!Q_tHIjQJuV5Tdt1m_gXoJE_u9RO1nhKgPD5iBL92_vQ

    Regards,

Viewing 14 replies - 16 through 29 (of 29 total)