• Resolved ruben6

    (@ruben6)


    When we’re trying to activate WooCommerce EU VAT Assistant version 2.0.23.211019 we’re getting the following error:

    Fatal error: Declaration of Monolog\Handler\RotatingFileHandler::close() must be compatible with Monolog\Handler\StreamHandler::close(): void in /home/ruconnectnl/domains/ruconnected.nl/public_html/staging/wp-content/plugins/woocommerce-eu-vat-assistant/src/embedded-framework/wc-aelia-foundation-classes-embedded/src/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php on line 0

    There seems to be incompatibility with another plugin, the plugin connecting the store to the warehousing system. Which is using Monolog version 2.2.0.

    Would there be a way that we could use both plugins at the same time? Both are critical for running the store.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Diego

    (@daigo75)

    All our plugins use Monolog 1.26.x, because we must maintain compatibility with WordPress, which can run on PHP 5.6. Monolog 2.x required PHP 7.2 or higher, therefore we won’t be able to use that version, as that can cause incompatibility issues with many other plugins that run on lower PHP versions.

    Since neither the EU VAT Assistant, nor the other plugin you’re using, are using a custom namespace for 3rd party libraries, you can end up having two different versions of Monolog, loaded “piecemeal” by each entity and causing the error you see. Without custom namespacing, there isn’t a way to load two versions of the exact same library.

    This leaves you with two options:
    1. You can downgrade the Monolog library in the plugin that links to the warehousing system.
    2. You can upgrade the Monolog library inside the Aelia Foundation Classes (AFC, for short). The library is stored in folder wp-content/plugins/woocommerce-eu-vat-assistant/src/embedded-framework/wc-aelia-foundation-classes-embedded/src/vendor/monolog/. If you replace the Monolog version in file wp-content/plugins/woocommerce-eu-vat-assistant/src/composer.json and use Composer to update it, then the AFC will use the new version.

    Important notes
    * Modifying the code of an existing plugin requires technical knowledge. If you don’t have sufficient experience, we would recommended to ask your developer to do that.
    * Version 1.26.x and 2.x of Monolog should should be cross-compatible, in terms of usage. Due to that, the EU VAT Assistant should be able to use the new version right away. However, this kind of modification is not officially supported, therefore we can’t guarantee that this will be the case, we strongly recommend to run extensive tests, before applying the changes to a live site.
    * If you upgrade the Monolog library and update the EU VAT Assistant, or the AFC in the future, your changes will be lost. Due to that, you will have to repeat the upgrade process again, immediately after updating the plugin.

    Thread Starter ruben6

    (@ruben6)

    Thanks for the stellar support. This is definitely something we can work with.

    As a test, on a staging server, I’ve replaced the folder below with the Monolog folder of the fulfilment plugin.

    wp-content/plugins/woocommerce-eu-vat-assistant/src/embedded-framework/wc-aelia-foundation-classes-embedded/src/vendor/monolog/

    Now everything seems to work, also with debug mode on I’m not getting any PHP errors any more. Will this suffice, or do I indeed have to ask a developer to do the step below?

    “If you replace the Monolog version in file wp-content/plugins/woocommerce-eu-vat-assistant/src/composer.json and use Composer to update it, then the AFC will use the new version.”

    Composer.json has the following contents. I don’t see anything referring to Monolog.

    {
    	"require": {
    		"econea/nusoap": "0.9.7"
    	},
    	"require-dev": {
    		"mockery/mockery": "^1.3"
      },
    	"autoload" : {
    		"classmap": ["lib/"]
    	},
    	"scripts": {
    		"post-update-cmd": [
    			"npm install --prefix js/frontend/checkout",
    			"npm run build --prefix js/frontend/checkout"
    		],
    		"post-install-cmd": [
    			"npm install  --prefix js/frontend/checkout",
    			"npm run build --prefix js/frontend/checkout"
    		]
    	}
    }
    Plugin Author Diego

    (@daigo75)

    If you already updated the library in the folder, then you won’t need to change the Composer file. That step is, simply, a convenience to avoid having to copy/paste files manually.

    Composer is a dependency management tool. One can update the composer.json file, then run composer update, and the tool fetches the updated library automatically. It’s easier than having to download each library manually and keeping it up to date, but, since you did that already, you should be good to go.

    Plugin Author Diego

    (@daigo75)

    @ruben6 a quick heads up. We’re going to release a minor update today. Nothing has changed, we just re-tested the plugin with WooCommerce 5.9. Please remember that, if you update the plugin, you will have to update the Monolog library embedded with it as well.

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