tommytx Posted December 17, 2020 Share Posted December 17, 2020 (edited) Not asking you to troubleshoot for me but to pop in any thoughts you might have on how YOU would troubleshoot this problem.. Thanks This is a wp site.. and generated the following error.. Notice: Undefined index: USER_AGENT in /home/luxuryrealtygrp/public_html/wp-content/plugins/LRG/Masked/Filters.php on line 31 This is what line 31 that is being called out: Line 31: function lrg_masked_field($false, $field_name){ if(is_user_logged_in() || stripos($_SERVER['USER_AGENT'], 'google') !== false || stripos($_SERVER['USER_AGENT'], 'yahoo') !== false || stripos($_SERVER['USER_AGENT'], 'bing') !== false){ return false; } Just looking for ideas that might help to chase this down.. My guess is that USER_AGENT since in all caps may be an environment variable.. Is there a way to display all environment variablles and if they are set or not. Any ideas or thoughts would be appreciated.. Thanks! Edited December 17, 2020 by tommytx Quote Link to comment https://forums.phpfreaks.com/topic/311885-is-there-a-way-on-php-to-print-or-view-all-the-environment-variables-and-to-determine-if-they-are-set-or-not/ Share on other sites More sharing options...
requinix Posted December 17, 2020 Share Posted December 17, 2020 Capital letters does not make it an environment variable. It it were then you would probably be using $_ENV instead of $_SERVER. https://www.php.net/manual/en/reserved.variables.server.php HTTP headers stored in $_SERVER are prefixed by "HTTP_". Take a look on that page to see if maybe there's something useful. To the question itself (since it is possible the User-Agent header may not be passed) then then solution is to check if the value is set before trying to use it. Quote Link to comment https://forums.phpfreaks.com/topic/311885-is-there-a-way-on-php-to-print-or-view-all-the-environment-variables-and-to-determine-if-they-are-set-or-not/#findComment-1583202 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.