Title: Errors From Code Snippets Plugin In Error Log
Last modified: January 22, 2023

---

# Errors From Code Snippets Plugin In Error Log

 *  Resolved [monsterdevelopment](https://wordpress.org/support/users/monsterdevelopment/)
 * (@monsterdevelopment)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/errors-from-code-snippets-plugin-in-error-log/)
 * We have been using Code Snippets for years and we have noticed that after the
   most recent update, we are now seeing some errors from the plugin in our error
   log:
   PHP Warning: Invalid argument supplied for foreach() in /nas/content/live/
   sitenamehere/wp-content/plugins/code-snippets/php/snippet-ops.php(505) : eval()’
   d code on line 8Any thoughts on this and how we can eliminate this error?Thank
   you!

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

 *  [druideniggi](https://wordpress.org/support/users/druideniggi/)
 * (@druideniggi)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/errors-from-code-snippets-plugin-in-error-log/#post-16399503)
 * On our test system:
 * We also have an issue when moving to PhP 8 support:
 * /code-snippets/php/snippet-ops.php(505) : eval()’d code on line 27
    -  This reply was modified 3 years, 4 months ago by [druideniggi](https://wordpress.org/support/users/druideniggi/).
 *  [umduck](https://wordpress.org/support/users/umduck/)
 * (@umduck)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/errors-from-code-snippets-plugin-in-error-log/#post-16423195)
 * Seeing similar issues in our production environment once we switched PHP from
   7.4 to 8.1. I’ve gone through and disabled the numerous code snippets we are 
   using with no luck in stopping the numerous errors we are seeing in the error
   logs:
 *     ```wp-block-code
       plugins/code-snippets/php/snippet-ops.php(505) : eval()'d code on line 2"
       ```
   
 * Trying to troubleshoot in DEV but without traffic I am not generating the same
   errors in our DEV environment. I’ve even tried running each code snippet through
   a php8.1 checker and it shows nothing currently as an issue. On DEV I have all
   error reporting turned on, using Query Monitor and I can not see the same errors
   from a fresh copy of data in DEV to replicate.
 *  [umduck](https://wordpress.org/support/users/umduck/)
 * (@umduck)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/errors-from-code-snippets-plugin-in-error-log/#post-16426882)
 * I believe I’ve found the issue in our code producing the new errors that were
   not present before php8.1 was enabled. Adding the updated Code Line Checking 
   script listed below helped me troubleshoot the issue in order to figure out which
   scripts were now causing PHP warnings that were not before.
    - [Display Line Numbers snippet](https://wordpress.org/support/topic/display-line-numbers-snippet/)
      
      Started by: [GermanKiwi](https://wordpress.org/support/users/germankiwi/)
 *  [druideniggi](https://wordpress.org/support/users/druideniggi/)
 * (@druideniggi)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/errors-from-code-snippets-plugin-in-error-log/#post-16434334)
 * I compared all snippets with line 27 and couldn’t see any malfunctions.with a
   snippet, however, I had a blank line before line 27 that didn’t belong there
 *  [umduck](https://wordpress.org/support/users/umduck/)
 * (@umduck)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/errors-from-code-snippets-plugin-in-error-log/#post-16434396)
 * An empty line is fine, as a matter of fact, you can bump your code snippet code
   down a line, one by one so that you have an empty line at line 27, until you 
   produce the same error warning but now at line 28. That may help you identify
   which line of code seems to be an issue.
 * I had the same problem, I couldn’t find any code that looked like an issue, however,
   eventually I discovered the way I was adding HTML/SCRIPT code into the wp_footer()
   hook was actually not the correct way of doing it, even though it was still working
   and also producing a PHP Warning once moved to 8.1.
 * Good luck [@druideniggi](https://wordpress.org/support/users/druideniggi/)
 *  Thread Starter [monsterdevelopment](https://wordpress.org/support/users/monsterdevelopment/)
 * (@monsterdevelopment)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/errors-from-code-snippets-plugin-in-error-log/#post-16434459)
 * Thanks for the input… we will check our snippets again based on this feedback.
 *  [Ericmuc](https://wordpress.org/support/users/ericmuc/)
 * (@ericmuc)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/errors-from-code-snippets-plugin-in-error-log/#post-16452347)
 * Hi, I also have shown an error in the log: ** CRITICAL Unclosed ‘{‘ on line 7
   in /www/domain/wp-content/plugins/code-snippets-pro/php/admin-menus/class-edit-
   menu.php(261) : eval()’d code on line 12**
 *  [umduck](https://wordpress.org/support/users/umduck/)
 * (@umduck)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/errors-from-code-snippets-plugin-in-error-log/#post-16452496)
 * [@ericmuc](https://wordpress.org/support/users/ericmuc/) it looks like you are
   using their pro version I would suggest logging into your Code Snippets pro account
   through their website and submit a support ticket there or start a new thread
   since your code error looks different than the ones reported in this thread.
 * [https://codesnippets.pro/support/](https://codesnippets.pro/support/)

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

The topic ‘Errors From Code Snippets Plugin In Error Log’ 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/)

## Tags

 * [php 8](https://wordpress.org/support/topic-tag/php-8/)

 * 8 replies
 * 4 participants
 * Last reply from: [umduck](https://wordpress.org/support/users/umduck/)
 * Last activity: [3 years, 4 months ago](https://wordpress.org/support/topic/errors-from-code-snippets-plugin-in-error-log/#post-16452496)
 * Status: resolved