PHP 8 fatals on wp-admin
-
APIExperts Square for WooCommerce v4.2.5 is causing PHP fatals on my
/wp-admin/backend. My server is running PHP 8.1 so I suspect just a few compatibility issues that need patched. Below are the errors and patches I applied to get my site healthy.Error #1
PHP Fatal error: Uncaught Error: Undefined constant “WOOSQU_PLUS_APPID” in /www/public/wp-content/plugins/woosquare/admin/modules/product-sync/product_sync.php:178Workaround fix
Addeddefine( 'WOOSQU_PLUS_APPID','sq0idp-OkzqrnM_vuWKYJUvDnwT-g' );to my wp-config.php file as I found defined in the plugin code.Error #2
PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, stdClass given in /www/public/wp-content/plugins/woosquare/admin/modules/product-sync/_inc/SquareToWooSynchronizer.class.php:1168Workaround fix
Changed line 1168 to the following.
@$count = is_countable( json_decode($response['body'] ) ) ? count(json_decode($response['body'])) : 0;
The topic ‘PHP 8 fatals on wp-admin’ is closed to new replies.