Title: PHP Warning: Undefined array key &#8220;HTTP_REFERER&#8221;
Last modified: January 14, 2024

---

# PHP Warning: Undefined array key “HTTP_REFERER”

 *  Resolved [ioria04](https://wordpress.org/support/users/ioria04/)
 * (@ioria04)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-http_referer/)
 * I have thousands of those warnings my error_log, generated multiple each day.
 * That’s the error.
 *     ```wp-block-code
       [14-Jan-2024 14:32:50 UTC] PHP Warning:  Undefined array key "HTTP_REFERER" in /home/gialloec/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()'d code on line 16
       ```
   
 * Now, searching on line 582 of file snippet-ops.php, I find this statement
 *     ```wp-block-code
           $result = eval( $code );
       ```
   
 * just to give more context, this is the function. Can somebody help me?
 * Regards.
 * Mario
 *     ```wp-block-code
       /**
        * Execute a snippet.
        * Execute operation.
        *
        * Code must NOT be escaped, as it will be executed directly.
        *
        * @param string  $code  Snippet code to execute.
        * @param integer $id    Snippet ID.
        * @param boolean $force Force snippet execution, even if save mode is active.
        *
        * @return ParseError|mixed Code error if encountered during execution, or result of snippet execution otherwise.
        *
        * @since 2.0.0
        */
       function execute_snippet( string $code, int $id = 0, bool $force = false ) {
       	if ( empty( $code ) || ! $force && defined( 'CODE_SNIPPETS_SAFE_MODE' ) && CODE_SNIPPETS_SAFE_MODE ) {
       		return false;
       	}
   
       	ob_start();
   
       	try {
       		$result = eval( $code );
       	} catch ( ParseError $parse_error ) {
       		$result = $parse_error;
       	}
   
       	ob_end_clean();
   
       	do_action( 'code_snippets/after_execute_snippet', $code, $id, $result );
       	return $result;
       }
       ```
   

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

 *  Thread Starter [ioria04](https://wordpress.org/support/users/ioria04/)
 * (@ioria04)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-http_referer/#post-17343467)
 * Need to add that at line 16 there is no attempt to access array using key “HTTP_REFERER”.
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-http_referer/#post-17392262)
 * This error is coming from one of your snippets, not from the plugin – the message
   is a little confusing.
 * You should be able to identify which snippet it is with a search for `HTTP_REFERER
   @line:16`
 *  Thread Starter [ioria04](https://wordpress.org/support/users/ioria04/)
 * (@ioria04)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-http_referer/#post-17392732)
 * Thank you [@bungeshea](https://wordpress.org/support/users/bungeshea/). I think
   I have found the snippet, disabled, let’s see what happens now.
 * Have another question… who is generating the error in error_log? is wordpress?
   I do not find it in internet.
 * Regards.

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

The topic ‘PHP Warning: Undefined array key “HTTP_REFERER”’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [ioria04](https://wordpress.org/support/users/ioria04/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-http_referer/#post-17392732)
 * Status: resolved