Content Error or Suggest an Edit
Notice a grammatical error or technical inaccuracy? Let us know; we will give you credit!
I ran into an issue with the Post SMTP Mailer/Email Log and the official WooCommerce – MailerLite plugin.
The error is as follows:
[03-Apr-2021 18:57:26 UTC] PHP Fatal error: Cannot redeclare Clue\StreamFilter\append() (previously declared in /wp-content/plugins/woo-mailerlite/vendor/clue/stream-filter/src/functions.php:105) in /wp-content/plugins/post-smtp/Postman/Postman-Mail/mailgun/vendor/clue/stream-filter/src/functions.php on line 17
It seems as though both plugins include the clue\streamfilter library via composer and during a checkout will utilize the same name space and fail with the above error.
Unfortunately WordPress doesn’t handle dependencies very well. There is no core management of PHP libraries. So when multiple plugins include a dependency, a conflict can arise and a race condition occurs like the above error.
The solution? PHP Scoper is an alternative, but really isn’t idea. You can however as the plugin developer to look at utilizing this.
The other solution is that WordPress makes some core changes to help support the use of plugins utilize libraries with composer or sandboxing name spaces. You can read more below
Hope this helps!