• Hi, one of my customers is using this plugin for his woocommerce website, and I noticed th logs fill up with this message:

    Undefined array key “SERVER_NAME” in /wp-content/plugins/woosa-in3/woosa-in3.php on line 44

    This message only appears when running wp-cli and makes sense, because in a cli environment this variable is not set.

    However, since wp-cli is used extensively for maintenance purposes, it would be great if we can eliminate this warning message.

    Perhaps something along these lines would fix the issue:

    $_SERVER['SERVER_NAME'] ?: php_uname("n")

    I hope you can fix this in the next update to avoid filling up my logfiles! ??

    Regards,
    Rinck

    Info: Ubuntu 18.04 LTS – PHP 8.0 – WordPress 5.8

    • This topic was modified 3 years, 6 months ago by Netson.
    • This topic was modified 3 years, 6 months ago by Netson.
Viewing 1 replies (of 1 total)
  • Thread Starter Netson

    (@netson)

    I actually just tested the code above and (for obvious reasons) it still outputs the warning; instead, this fixes the issue:

    Replace on line 44:
    $_SERVER["SERVER_NAME"]
    with
    (in_array('SERVER_NAME', $_SERVER) ? $_SERVER['SERVER_NAME'] : php_uname("n"))

Viewing 1 replies (of 1 total)
  • The topic ‘SERVER_NAME not in $_SERVER’ is closed to new replies.