• Resolved prbond

    (@prbond)


    Hi

    I have this error :
    Notice: Undefined index: SERVER_NAME in /var/www/wp-content/plugins/dynamic-widgets/classes/dynwid_class.php on line 639
    Notice: Undefined index: HTTP_HOST in /var/www/wp-content/plugins/dynamic-widgets/classes/dynwid_class.php on line 640

    in file /var/www/wp-content/plugins/dynamic-widgets/classes/dynwid_class.php

    private function getHostname() {
    $server_name = $_SERVER[‘SERVER_NAME’];
    $hostname = $_SERVER[‘HTTP_HOST’];

    if (! empty($hostname) && $hostname != $server_name ) {
    return $hostname;
    }

    return $server_name;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Qurl

    (@qurl)

    That happens probably when you work with CLI. Then it’s not available. I’ll add a condition for that.

    Thread Starter prbond

    (@prbond)

    Hi

    yes, i use wp-cli to install Dynamic Widgets.

    You have juste change in file classes/dynwid_class.php

    line 639

    private function getHostname() {
    $server_name = $_SERVER[‘SERVER_NAME’];
    $hostname = $_SERVER[‘HTTP_HOST’];

    if (! empty($hostname) && $hostname != $server_name ) {
    return $hostname;
    }

    return $server_name;
    }

    by

    private function getHostname() {
    $server_name = ( isset($_SERVER[‘SERVER_NAME’]) ) ? $_SERVER[‘SERVER_NAME’] : NULL;
    $hostname = ( isset($_SERVER[‘HTTP_HOST’]) ) ? $_SERVER[‘HTTP_HOST’] : NULL;

    if (! empty($hostname) && $hostname != $server_name ) {
    return $hostname;
    }

    return $server_name;
    }

    In function getIP() you have make the test

    Works for me.

    Bye

    • This reply was modified 8 years, 7 months ago by prbond.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Notice: Undefined index:’ is closed to new replies.