• Resolved monsterdevelopment

    (@monsterdevelopment)


    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 8

    Any thoughts on this and how we can eliminate this error?

    Thank you!

Viewing 8 replies - 1 through 8 (of 8 total)
  • 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 1 year, 6 months ago by druideniggi.

    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:

    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.

    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.

    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

    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

    Thread Starter monsterdevelopment

    (@monsterdevelopment)

    Thanks for the input… we will check our snippets again based on this feedback.

    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

    @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/

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Errors From Code Snippets Plugin In Error Log’ is closed to new replies.