cedaro / satispress

Expose installed WordPress plugins and themes as Composer packages.
500 stars 49 forks source link

Fatal error ... #85

Closed Nobiuss closed 5 years ago

Nobiuss commented 5 years ago

Hi Team,

We are having a Fatal error on our satispress site.

---> Fatal error: Uncaught Error: Call to a member function error() on null in /home/be/apps/plugins/wp-content/plugins/satispress/src/Provider/Upgrade.php:144 Stack trace: #0 /home/be/apps/plugins/wp-content/plugins/satispress/src/Provider/Upgrade.php(118): SatisPress\Provider\Upgrade->cache_packages() #1 /home/be/apps/plugins/wp-includes/class-wp-hook.php(286): SatisPress\Provider\Upgrade->maybe_upgrade('') #2 /home/be/apps/plugins/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #3 /home/be/apps/plugins/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #4 /home/be/apps/plugins/wp-admin/admin.php(156): do_action('admin_init') #5 /home/be/apps/plugins/wp-admin/themes.php(10): require_once('/home/...') #6 {main} thrown in /home/*****be/apps/plugins/wp-content/plugins/satispress/src/Provider/Upgrade.php on line 144 <---

Is quite unsure where we need to start searching.

In the past we had some issues with plugins that had "lite" versions. ( example version "4.3.8 lite" ). This is now not the issue.

Hope we can find a solution together.

Kind regards, KIM

bradyvercher commented 5 years ago

It looks like you're encountering an error when trying to cache existing packages during an upgrade, but the logger wasn't available, which is what's causing that fatal error. The last commit should make the logger available to prevent that error, but you'll need to implement a logger to figure out why the packages aren't being cached.

koenHuybrechts commented 5 years ago

Ah. Would it be possible to use the default WP error logging? https://codex.wordpress.org/Debugging_in_WordPress This can be used as a fallback. Monolog is a great tool, but if you need to set this up, a fallback can be a good option?

bradyvercher commented 5 years ago

@koenHuybrechts The default error logging is used for fatal errors like this, but I don't think debug.log is really the appropriate place to log the types of messages that SatisPress emits.

Monolog isn't absolutely necessary, so you could use any logger that implements the Psr\Log\LoggerInterface interface. I'm not opposed to a logging certain important events by default, but that does come with some overhead. Feel free to open a new issue if you'd like to start a discussion about that.