• Since upgrading to PHP8, my logs are full of warnings like:

    Undefined array key "HTTP_USER_AGENT" in /wp-content/themes/himalayas/inc/functions.php on line 62

    This is because your code doesn’t check for the existence of the key before accessing it:

    $himalayas_user_agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );

    Please add ‘isset’ check for this key before trying to access it, like so:

    $himalayas_user_agent = ( isset($_SERVER['HTTP_USER_AGENT']) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '' );

    • This topic was modified 1 year, 2 months ago by mattf10.
Viewing 1 replies (of 1 total)
  • Hi @mattf10,

    Thanks for the suggestaion. I will discuss the topic with the developer team and if there’s an issue with the theme we will be fixing on the upcoming version of the theme release.

    Let me know of any other confusion or issues and I will be back.

    Regards

Viewing 1 replies (of 1 total)
  • The topic ‘Undefined array key “HTTP_USER_AGENT”’ is closed to new replies.