Title: PHP Notice 403.php
Last modified: August 30, 2016

---

# PHP Notice 403.php

 *  Resolved [OviLiz](https://wordpress.org/support/users/ovib/)
 * (@ovib)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-notice-403php/)
 * Hi guys,
    in my logs I have this:
 * > Undefined index: HTTP_USER_AGENT in …./wp-content/plugins/bulletproof-security/
   > 403.php on line 100
 * This is related to
 *     ```
       # BEGIN USERAGENT FILTER
       if ( !preg_match('/BPSUserAgentPlaceHolder/', $_SERVER['HTTP_USER_AGENT']) ) {
       # END USERAGENT FILTER
       ```
   
 * Is there anything you can do to avoid the notice?
 * Thank you.
 * [https://wordpress.org/plugins/bulletproof-security/](https://wordpress.org/plugins/bulletproof-security/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-notice-403php/#post-6607219)
 * [http://stackoverflow.com/questions/14130830/php-undefined-index-http-user-agent](http://stackoverflow.com/questions/14130830/php-undefined-index-http-user-agent)
 * > The User-Agent header is optional. Firewalls may filter it or people may configure
   > their clients to omit it. Simply check using isset() if it exists. Or even 
   > better, use !empty() as an empty header won’t be useful either:
 * The php error does not occur on my test site since my server has this global 
   variable “set” by default.
 * [http://stackoverflow.com/questions/16330496/php-notice-undefined-index-http-user-agent-in-line-2](http://stackoverflow.com/questions/16330496/php-notice-undefined-index-http-user-agent-in-line-2)
 * The solution is to check if the variable is set with isset. We will add that 
   additional conditional check in the next BPS version.
 *     ```
       # BEGIN USERAGENT FILTER
       if ( isset($_SERVER['HTTP_USER_AGENT']) && !preg_match('/BPSUserAgentPlaceHolder/', $_SERVER['HTTP_USER_AGENT']) ) {
       # END USERAGENT FILTER
       ```
   
 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-notice-403php/#post-6607222)
 * Hmm actually that may be a bad thing to do. We need to check if this negates 
   checking and blocking empty user agent fields, which are used by spambots and
   hackerbots and need to be blocked. In theory, since this line of code only pertains
   to the User Agent filter then it will probably be ok to add. Testing is required
   before this will be added if everything is ok.
 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-notice-403php/#post-6607223)
 * Also check your wp-config.php file to see if WP_DEBUG is turned on. WP_DEBUG 
   should only be used during debugging and should be turned Off after you are done
   debugging.
 *  Thread Starter [OviLiz](https://wordpress.org/support/users/ovib/)
 * (@ovib)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-notice-403php/#post-6607225)
 * Hi guys,
    actually WP_DEBUG is on because I’m debugging and anyway I’m not using
   public file to print all sort of possible warnings. There are even some plugins
   that are conflicting or are bad coded and I want to keep the DEBUG on (but I’m
   not exposing this).
 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-notice-403php/#post-6607226)
 * Ok once you are done debugging then turn debugging off. Debugging is not supposed
   to be/intended to be left turned on normally. Debugging will slow down your overall
   website performance. How much I do not know, but that is standard for all debugging/
   debuggers.
 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-notice-403php/#post-6607230)
 * What will be done in BPS .52.7 is to suppress the php error with an @ symbol 
   since this php error is insignificant.
 *     ```
       # BEGIN USERAGENT FILTER
       if ( @!preg_match('/BPSUserAgentPlaceHolder/', $_SERVER['HTTP_USER_AGENT']) ) {
       # END USERAGENT FILTER
       ```
   
 *  Thread Starter [OviLiz](https://wordpress.org/support/users/ovib/)
 * (@ovib)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-notice-403php/#post-6607236)
 * Thank you a lot!
 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-notice-403php/#post-6607371)
 * New code has been added to suppress this php error in BPS .52.7 – this thread
   has been resolved.
 * Thread Start Date: 10-2-2015
    Thread Resolved/Current Date: 10-6-2015 Comments:
   New code has been added to suppress this php error in BPS .52.7

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘PHP Notice 403.php’ is closed to new replies.

 * ![](https://ps.w.org/bulletproof-security/assets/icon-128x128.png?rev=1731938)
 * [BulletProof Security](https://wordpress.org/plugins/bulletproof-security/)
 * [Support Threads](https://wordpress.org/support/plugin/bulletproof-security/)
 * [Active Topics](https://wordpress.org/support/plugin/bulletproof-security/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/bulletproof-security/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/bulletproof-security/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [AITpro](https://wordpress.org/support/users/aitpro/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/php-notice-403php/#post-6607371)
 * Status: resolved