• Resolved dbceric

    (@dbceric)


    Hello,

    I have been using Code Snippets since November with no problem. Today, I disable one of the code snippets and website worked fine. I decided I wanted to re-enable it and when I did, my site crashed. I got a hold of my host and they deactivated the plugin which brought my site back up. They asked that I delete and do a fresh install. I did that and when activated, it crashed again with the same error. They deactivated the plugin again and asked me to contact the vendor.
    Below is the error I am receiving. How can I fix this?

    Uncaught Error: syntax error, unexpected end of file in /home4/dogsbych/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(361) : eval()’d code on line 3
    execute_snippet()
    wp-content/plugins/code-snippets/php/snippet-ops.php:450execute_active_snippets()
    wp-includes/class-wp-hook.php:288apply_filters()
    wp-includes/class-wp-hook.php:312do_action()
    wp-includes/plugin.php:478

Viewing 4 replies - 1 through 4 (of 4 total)
  • Note that Code Snippet stores all data to database. If you reinstall this plugin, it does not change the database at all. You must delete the individual record with MySQL tool. I have deleted or marked active as 0 with phpMyAdmin.

    “syntax error” – typical error. If you don’t have access to phpMyAdmin, never create backend snippets. Invalid code in them will crash your site. Invalid code in frontend snippet needs sometimes also phpMyAdmin in situations, where disabling of a snippet has been failed.

    The main problem of this snippet is that it seems to store a temporary record into database but afterwards returns the correct version. But this process fails with all backend snippets. The system should be different. Temporary saved record should just be checked and set first time active 0. If the saved file is valid, afterward would be changed active 0 to 1. The current saving process is extremely dangerous and risky!

    Thread Starter dbceric

    (@dbceric)

    Thank you for your reply. I received the code snippet from a vendor support for another plugin.

    I do have access to phpMyAdmin. I am not knowledgeable on coding. What is the recommended fix? Should I delete the record with MySQL or can someone advise on what I should correct/change in the coding? My other thought is to go back to vendor that gave me the code and ask them to recommend code fix.

    You can deactivate the problematic setting by setting “active” as value “0” or just delete it.

    Note also the field “scope”. Not use value “global” if you want it only to be used in front-end. Change scope as “front-end” if it has the value “global”.

    If you have some other application to create PHP, you can copy the content of the snippet, fix the content and return it back to the database field. But be sure to have correct syntax.

    WARNING! If you make a backup copy of a snippet, be aware that you don’t by mistake activate the used version and bacup copy of it at the same time! If they have the same function definition the backend of Code Snippet can’t handle this situation. You must you then with phpMyAdmin in order to deactivate the copy. This is very bad feature also.

    Both used version and backup copy could both have valid syntax, but together the cause duplicate function definition, which will crash the site.

    Plugin Author Shea Bunge

    (@bungeshea)

    Hi @dbceric,

    This error is due to a problem in the code of one of your snippets.

    The recommended way to fix this is to enable safe mode, and then log in and deactivate the snippet that is causing the problem.

    If you’re not sure how to fix the snippet so that it works, feel free to post it here and I can make some corrections for you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Uncaught error’ is closed to new replies.