This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 6 replies, has 2 voices.

Last updated by ralphd-3 1 year ago.

Assigned support staff: Diego Pereira.

Author Posts
September 25, 2018 at 3:33 pm

ralphd-3

I am trying to: Save a product in Woocommerce Products

Link to a page where the issue can be seen:
This is inside the admin - no link

I expected to see:
it to be saved as normal

Instead, I got:
fatal error 500

September 25, 2018 at 3:36 pm #2764575

ralphd-3

the debug.log file shows the following fatal error

[25-Sep-2018 15:02:50 UTC] PHP Catchable fatal error: Argument 1 passed to WPML_Media_Post_Images_Translation::translate_images_in_post_content() must be an instance of WP_Post, null given, called in /var/www/blahblah/blahblah/blahblah/wp-staging/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-post-images-translation.php on line 98 and defined in /var/www/blahblah/blahblah/blahblah/wp-staging/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-post-images-translation.php on line 121

September 26, 2018 at 8:34 pm #2768699

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello @ralphd-3, welcome to the WPML support Forum!

- Does this error occur only in a specific product or in all products?
- It happens in the original language or only in the translation?

Please try the following:
- Go to WPML > Settings > Post Type Translation and check if the Media (Attachments) post type is set to translatable.
- Scroll down to "Media Settings", check the boxes and run the scan. Set your media preferences on the checkboxes below and save.
- Go to the edit screen of the product (original language), do a small modifictation and save
- Update the translation and save

Does the same error occur after these steps? If yes, please disable WPML Media and see if the error persists.

I also checked the settings of your server through debug log and saw that some items need attention:
PHP Version
Upgrade from PHP to version 7 or higher. This is a practice recommended by the WordPress.org website: https://wordpress.org/about/requirements/

MaxInputVars
Currently your server is configured with MaxInputVars = 1000, which is too low and can cause problems. Please increase this to 10,000. There are two options to do this:
== php.ini file
Open the php.ini file and insert/edit this line:

max_input_vars = 10000

hidden link
== .htaccess file

php_value max_input_vars 10000

Please let me know if it worked for you.

All the best,
Diego

October 1, 2018 at 3:50 pm #2778670

ralphd-3

Hi Diego,

Thanks for your support.

- The error does not occur for all products
- And the error occurs in the original language, not in the translated language

I have tried all your suggestion, but to no avail. The error persists.

Can I submit new debug info for you to verify?

The same error shows in the log file:
[01-Oct-2018 15:40:22 UTC] PHP Catchable fatal error: Argument 1 passed to WPML_Media_Post_Images_Translation::translate_images_in_post_content() must be an instance of WP_Post, null given, called in /var/www/xxx/xxx/wp-staging/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-post-images-translation.php on line 98 and defined in /var/www/xxx/xxx/wp-staging/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-post-images-translation.php on line 121

Thank you in advance.

October 1, 2018 at 8:45 pm #2779471

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi there,

Please send us access to your WordPress dashboard (website URL, login and password) I'll check and do some tests. - Please use the private field to send the sensitive data - do not post if you do not see it.

It would be better if you give me a test site rather than the live site.

IMPORTANT Please backup a working copy of site files and database before.

Please also send the link of the product and the steps to reproduce the issue.

Kind regards,
Diego

October 1, 2018 at 9:25 pm
October 2, 2018 at 1:49 pm #2781718

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi there,

Thanks. As this issue only happens in some products, it seems to be related to the product settings. Maybe something in the product table has been corrupted (maybe in the creation of the staging website).

I did some testing with the product settings you sent me and I could not find the cause of the error. After that, I installed the "duplicate post" plugin and duplicated the product. To my surprise, this new product worked normally. You can check here: hidden link

If the problem is occurring only in a few products, you can use these steps to fix the issue:
- Go to Products > All Products (default language)
- Mouse over on the product and click on "Duplicate"
- Edit the new product and click on publish
- Edit the translation to publish it as well
- Go back to Products > All products and delete the original product
- Delete it from the trash as well
- Now you should be able to use the same slug on the new product

IMPORTANT: Please backup your site first before making any change, this is important for security reasons.

Please let me know if it worked for you.

Regards,
Diego

October 2, 2018 at 9:09 pm #2782834

ralphd-3

Thanks Diego.

Yeah maybe it has something to do with the staging copy. Let's see if the problem persists when we'll update everything on the live version. Thank you for showing me a work around to the problem for the time being!