• Resolved nestormarius

    (@nestormarius)


    Hello,

    My error_log file is full of this warning, which appears very random.

    PHP Warning: Undefined array key "HTTP_HOST" in /home/xxx/public_html/wp-content/plugins/ad-inserter/ad-inserter.php on line 11748

    Please investigate. Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter nestormarius

    (@nestormarius)

    I believe it can be fixed by adding $array['HTTP_HOST'] = [];

    Plugin Author Spacetime

    (@spacetime)

    Thread Starter nestormarius

    (@nestormarius)

    @spacetime thank you. I’ve only pasted the new lines you’ve added in the ad-inserter.php file, which apparently define the HTTP_HOST array key.

        $host = isset ($_SERVER ['HTTP_HOST']) ? $_SERVER ['HTTP_HOST'] : '';
        if ($host == '' && isset ($_SERVER ['SERVER_NAME'])) {
          $host = $_SERVER ['SERVER_NAME'];
        }

    and changed the modified line

        $url = remove_debug_parameters_from_url ((isset ($_SERVER ['HTTPS']) && $_SERVER ['HTTPS'] === 'on' ? "https" : "http") . '://'. $host . $_SERVER ['REQUEST_URI']);

    So far no more errors. Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Undefined array key “HTTP_HOST” PHP error’ is closed to new replies.