Title: Undefined array key &#8220;HTTP_USER_AGENT&#8221;
Last modified: August 12, 2023

---

# Undefined array key “HTTP_USER_AGENT”

 *  [mattf10](https://wordpress.org/support/users/mattf10/)
 * (@mattf10)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/undefined-array-key-http_user_agent-3/)
 * 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 2 years, 10 months ago by [mattf10](https://wordpress.org/support/users/mattf10/).

Viewing 1 replies (of 1 total)

 *  [Barsha Paudel](https://wordpress.org/support/users/barsha04/)
 * (@barsha04)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/undefined-array-key-http_user_agent-3/#post-16991060)
 * Hi [@mattf10](https://wordpress.org/support/users/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.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/himalayas/1.3.5/screenshot.jpg)
 * Himalayas
 * [Support Threads](https://wordpress.org/support/theme/himalayas/)
 * [Active Topics](https://wordpress.org/support/theme/himalayas/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/himalayas/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/himalayas/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Barsha Paudel](https://wordpress.org/support/users/barsha04/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/undefined-array-key-http_user_agent-3/#post-16991060)
 * Status: not resolved