humanmade / asset-manager-framework

A framework for overriding the WordPress media library with an external asset provider, such as a DAM
GNU General Public License v2.0
155 stars 7 forks source link

Compatibility Issue with WooCommerce Variable Products and MultilingualPress #54

Closed mattwatsoncodes closed 2 years ago

mattwatsoncodes commented 2 years ago

We are getting an issue when creating a Variable Product with WooCommerce and then attempting to translate that error via MultilingualPress.

Steps to recreate:

Fatal error: Uncaught Error: Return value of AssetManagerFramework\replace_attached_file() must be of the type string, bool returned
in /usr/src/app/vendor/humanmade/asset-manager-framework/inc/namespace.php on line 217

Call stack:

AssetManagerFramework\replace_attached_file()
wp-includes/class-wp-hook.php:307
WP_Hook::apply_filters()
wp-includes/plugin.php:189
apply_filters()
wp-includes/post.php:744
get_attached_file()
content/plugins/multilingualpress/src/modules/WooCommerce/TranslationUi/Product/MetaboxAction.php:1064
Inpsyde\M\M\W\T\P\MetaboxAction::getSourceProductVariationAttachmentData()
content/plugins/multilingualpress/src/modules/WooCommerce/TranslationUi/Product/MetaboxAction.php:172
Inpsyde\M\M\W\T\P\MetaboxAction::doSaveOperation()
content/plugins/multilingualpress/src/modules/WooCommerce/TranslationUi/Product/MetaboxAction.php:131
Inpsyde\M\M\W\T\P\MetaboxAction::save()
content/plugins/multilingualpress/src/modules/WooCommerce/ProductMetaboxesBehaviorActivator.php:140
Inpsyde\M\M\W\ProductMetaboxesBehaviorActivator::saveMetaboxes()
wp-includes/class-wp-hook.php:309
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:331
WP_Hook::do_action()
wp-includes/plugin.php:474
do_action()
content/plugins/multilingualpress/src/multilingualpress/TranslationUi/Post/MetaboxAction.php:470
Inpsyde\M\T\P\MetaboxAction::savePost()
content/plugins/multilingualpress/src/multilingualpress/TranslationUi/Post/MetaboxAction.php:279
Inpsyde\M\T\P\MetaboxAction::doSaveOperation()
content/plugins/multilingualpress/src/multilingualpress/TranslationUi/Post/MetaboxAction.php:114
Inpsyde\M\T\P\MetaboxAction::save()
content/plugins/multilingualpress/src/framework/Admin/Metabox/MetaboxUpdater.php:127
Inpsyde\M\F\A\M\MetaboxUpdater::saveMetabox()
content/plugins/multilingualpress/src/framework/Admin/Metabox/Metaboxes.php:455
Inpsyde\M\F\A\M\Metaboxes::saveMetaBoxes()
content/plugins/multilingualpress/src/framework/Admin/Metabox/Metaboxes.php:420
Inpsyde\M\F\A\M\Metaboxes::onPostSave()
content/plugins/multilingualpress/src/framework/Admin/Metabox/Metaboxes.php:245
Inpsyde\M\F\A\M\Metaboxes::Inpsyde\M\F\A\M\{closure}()
wp-includes/class-wp-hook.php:309
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:331
WP_Hook::do_action()
wp-includes/plugin.php:474
do_action()
wp-includes/post.php:4698
wp_insert_post()
wp-includes/post.php:4789
wp_update_post()
wp-admin/includes/post.php:426
edit_post()
wp-admin/post.php:227
Screenshot 2022-05-18 at 07 12 31

Mitigation

If you override the default image that is added to each product variation, and attempt to translate the product again, the above error does not occur.

roborourke commented 2 years ago

This should be fixed by updating the Altis media module using composer update altis/media -W.

Fix is in release 0.13.2