• Resolved 001122334455

    (@dkanika)


    Hello, I am adding some PHP into my site and sometimes the plugin automatically disables the snippet.

    Sometimes when i try to activate it from dashboard it gives an error – says what but not on what line

    Then activating it again, without any change to code, it goes live. And after some time it can again randomly deactivate the snippet

    I run the code through some online tools and there was no error detected… it would be very useful to know where the error is, or perhaps is this false negative if no other tools detected this error?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mircea Sandu

    (@gripgrip)

    Hi @dkanika,

    From what you are describing, it may be that the syntax of the code is correct but it may generate an error at runtime. For example, your code may be calling a function that is not always loaded before the snippet gets executed, in this case the syntax is 100% correct but when you run the code in a different context, if the function is not loaded, it will throw a fatal error, which WPCode will catch and disable the snippet to prevent you from getting locked out of your site.

    If activating the snippet from the list of snippets throws an error that is also an indicator that a part of code needed to correctly run the snippet is not always loaded but it depends on the actual error message you get. It sounds like the code you are trying to use is available in the admin but not in the frontend so that’s why activating in the admin works but when you run the snippet in the frontend it fails (or via AJAX in the list of snippets).

    If you can share more details (what error you receive, the snippet code) we can try to help you debug this.

    Thanks

    Thread Starter 001122334455

    (@dkanika)

    Hello, thanks for the reply. Currently it’s not giving any error and everything works fine, so I’ll wait until it happens again.

    Thread Starter 001122334455

    (@dkanika)

    Hello, got the error again

    Syntax error, unexpected &

    Here is the code: https://docs.google.com/document/d/14pEkBq6u6Vv7_YXv5uX57nuktkcdLIyfpHPYDbQL8kE/edit?usp=sharing

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘False negative?’ is closed to new replies.