• Resolved mickwall

    (@mickwall)


    Hi

    I am seeing a lot of warnings in my php error log.

    I wonder if you could help.

    The error is

    14-May-2019 09:11:47 UTC] PHP Warning: Cannot modify header information – headers already sent in /wp-content/plugins/my-tickets/mt-button.php on line 784

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    Unfortunately, this is most likely a problem in another plug-in or your theme that’s triggering an error in My Tickets.

    Most likely, you have some other software that’s printing information to the screen either in the ‘init’ phase or earlier, and that’s causing this error in My Tickets.

    In general, no content should be printed to the screen during the initialization phase, as that prevents headers from being sent.

    Thread Starter mickwall

    (@mickwall)

    OK Joe, Thanks. Any tips on working it out?

    Plugin Author Joe Dolson

    (@joedolson)

    First step is to find out what is causing the issue. Disable all plugins and see if it goes away; if not, switch to a default theme. Once you’ve got the warnings gone, activate things one at a time until you find out what is causing the issue.

    Thread Starter mickwall

    (@mickwall)

    Hi Joe

    I have done lots of debugging including using troubleshooting mode with no plugins enabled and the twenty nineteen theme, the error still occured!

    I am wondering if this error could be being created by cron jobs, I have added the following to your code and the error has stopped. I am not sure if this is right or even makes sense.

    function mt_set_user_unique_id() {
    $unique_id = ( isset( $_COOKIE[‘mt_unique_id’] ) ) ? $_COOKIE[‘mt_unique_id’] : false;
    if ( ! $unique_id ) {
    if ( !defined( ‘DOING_CRON’ ) )
    {
    $unique_id = mt_generate_unique_id();
    setcookie( ‘mt_unique_id’, $unique_id, time() + 60 * 60 * 24 * 7, COOKIEPATH, COOKIE_DOMAIN, true, true );
    }
    }
    }

    Apologies if this is wasting your time!

    Thread Starter mickwall

    (@mickwall)

    Hi

    I did a bit more tidying!

    function mt_set_user_unique_id() {
    if (( defined( ‘DOING_CRON’ ) AND DOING_CRON) == false)
    {
    $unique_id = ( isset( $_COOKIE[‘mt_unique_id’] ) ) ? $_COOKIE[‘mt_unique_id’] : false;
    if ( ! $unique_id )
    {
    $unique_id = mt_generate_unique_id();
    setcookie( ‘mt_unique_id’, $unique_id, time() + 60 * 60 * 24 * 7, COOKIEPATH, COOKIE_DOMAIN, true, true );
    }
    }
    }

    I can see the cookie being created when I refresh a page event in the back office. I assume this is meant to check / create the cookie every time a page is loaded?

    I am a develper but not wordpress / php!

    Love the plugin by the way, simple to use and just works!

    Thread Starter mickwall

    (@mickwall)

    Thanks for adding a fix to the latest update.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘PHP warning’ is closed to new replies.