Notice undefined user agent
-
Hi,
Thank you for the nice plugin. I do encounter a (small) problem and it would be nice you could fix it. In my error log I’m getting the followign notices.
[10-Jul-2015 21:47:15 UTC] PHP Notice: Undefined index: HTTP_USER_AGENT in /home/arevicoc/public_html/wp-content/advanced-cache.php on line 12This is caused by line 12 in wp-content/advanced-cache.php
$hyper_cache_is_mobile = preg_match('#(android|iphone|iemobile|up\.browser|up\.link|mmp|symbian|smartphone|midp|wap|phone|ipod|xoom|blackberry)#i', $_SERVER['HTTP_USER_AGENT']);is it posisble to check if this variable is set first, (since some servers don’t set it). You can change it to something like
$ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '' $hyper_cache_is_mobile = preg_match('#(android|iphone|iemobile|up\.browser|up\.link|mmp|symbian|smartphone|midp|wap|phone|ipod|xoom|blackberry)#i', $ua);thank you in advance
The topic ‘Notice undefined user agent’ is closed to new replies.