Search code examples
phpwordpressfatal-error

Wordpress return Plugin could not be activated because it triggered a fatal error


I have strange error on activate my own plugin for WordPress.

On activate plugin I get only message "Plugin could not be activated because it triggered a fatal error." And that's all (see http://prntscr.com/snxdkw ). I don't get more errors, after enable debug mode I get only errors with level E_NOTICE, that's no critical.

That error showing only on live server, locally all ok. Googling has no effects

Local:
PHP: 7.3.16
WordPress: 5.4.1

Server:
PHP: 7.3.16
WordPress: 5.4.1

I tried:

  1. Enabled debug log on local and server (result: no critical errors)
  2. Fixed all errors
  3. Reactivate plugin on my local WordPress (result: locally no same error)
  4. Looked in PHP log on server (result: no critical errors)
  5. Tryed follow from error message to error handler in WP core for understanding error initiator (result: not found error initiator)
  6. Wrote debug messages to debug.log in register_activation_hook and register_deactivation_hook (result: I don't get my debug messages, I think WordPress doesn't reach to register_activation_hook() )

Solution

  • Problem was resolved.

    json_decode() gave null as result, but this data put on function with array type variable. I don't know why PHP didn't give any errors.

    Problem solved via inline checking lines step-by-step.