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 thread is resolved. Here is a description of the problem and solution.

Problem:

debug.log is expanding rapidly because of an issue with the WooCommerce Product Add-ons plugin.

Solution:

Our second tier supporter has found a fix for this issue. Here is what you need to do.

1. Open this file with a code editor.

wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php

2. Starting on line number 151 replace this code.

foreach ( $addon['options'] as $opt_key => $option ) {
    $addons[ $key ]['options'][ $opt_key ]['label'] = apply_filters( 'wpml_translate_single_string', $option['label'], 'wc_product_addons_strings', $object_id . '_addon_' . $addon['type'] . '_' . $addon['position'] . '_option_label_' . $opt_key );
}

With this code:

if (array_key_exists("options", $addon)) {
    foreach ( $addon['options'] as $opt_key => $option ) {
        $addons[ $key ]['options'][ $opt_key ]['label'] = apply_filters( 'wpml_translate_single_string', $option['label'], 'wc_product_addons_strings', $object_id . '_addon_' . $addon['type'] . '_' . $addon['position'] . '_option_label_' . $opt_key );
    }
}

Andalso on around line 193 replace this code:

foreach ( $addon['options'] as $key => $option ) {
    if (
        $is_custom_prices_on &&
        isset( $option[ 'price_' . $client_currency ] ) &&
        $option[ 'price_' . $client_currency ]
    ) {
        $addons[ $add_id ]['options'][ $key ]['price'] = $option[ 'price_' . $client_currency ];
    } else {
        $addons[ $add_id ]['options'][ $key ]['price'] = apply_filters( 'wcml_raw_price_amount', $option['price'] );
    }
}

With this

if (array_key_exists("options", $addon)) {
    foreach ( $addon['options'] as $key => $option ) {
        if (
            $is_custom_prices_on &&
            isset( $option[ 'price_' . $client_currency ] ) &&
            $option[ 'price_' . $client_currency ]
        ) {
            $addons[ $add_id ]['options'][ $key ]['price'] = $option[ 'price_' . $client_currency ];
        } else {
            $addons[ $add_id ]['options'][ $key ]['price'] = apply_filters( 'wcml_raw_price_amount', $option['price'] );
        }
    }
}

3. Save the file.

Now the message on the debug log should not appear.

This topic contains 19 replies, has 4 voices.

Last updated by Itamar 3 weeks, 1 day ago.

Assigned support staff: Itamar.

Author Posts
August 18, 2019 at 1:14 am

emelieC

Hello,

When I turn debug on I get a rapidly expanding error log.

This is the error that is filling the file:

[18-Aug-2019 00:42:40 UTC] PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 151
[18-Aug-2019 00:42:40 UTC] PHP Notice: Undefined index: options in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 151
[18-Aug-2019 00:42:40 UTC] PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 151
[18-Aug-2019 00:42:40 UTC] PHP Notice: Undefined index: options in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 191
[18-Aug-2019 00:42:40 UTC] PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 191
[18-Aug-2019 00:42:40 UTC] PHP Notice: Undefined index: options in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 191
[18-Aug-2019 00:42:40 UTC] PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 191
[18-Aug-2019 00:42:40 UTC] PHP Notice: Undefined index: position in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 147
[18-Aug-2019 00:42:40 UTC] PHP Notice: Undefined index: position in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 149

Hope you can help. I need to use debug but it becomes the size of GB within minutes of use..

I have added details for you to log in so you can activate debug log in wp-config when you test it. Please do not forget to turn it off if not solved.

Kind regards,

Marcus

August 18, 2019 at 8:26 am #4411755

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support. Could you please follow below steps and let me know how it goes?

1. I noticed you are using an older version of WPML plugins on your site, please go to WP Dashboard >> Plugins >> Add new >> Commercial tab >> and try to update plugins from there.

If step 1 doesn't work then please update manually every WPML plugin with the latest ones downloaded from your account page. To do a manual update please follow these steps:

- Backup your database – see for example: http://wordpress.org/extend/plugins/wp-db-backup/

- Deactivate the existing WPML plugins and add-ons.

- Delete the plugin files – this does not delete your translations. You will simply delete the plugin files from your "wp-content/plugins" folder, NOT the database records.

- Download the updated plugins from our servers (https://wpml.org/account/downloads/) and upload them to the plugin directory.

- Activate the WPML plugin and add-ons.

2. Please clear all sorts of caches in your site plugin cache (W3 Total Cache) / CDN cache (if any) / browser cache and then see if it resolves the issue afterwards.

3. If still issue persists, please follow these steps in order to isolate the cause of the issue:
- Backup your site first before making any change, this is for security reasons.
- Deactivate all the plugins that are not related to WPML.
- Switch for a moment to a WordPress default theme like Twenty Seventeen.
- If the issue is gone, activate one by one to see which one there is an interaction issue.

Thank you

August 19, 2019 at 11:06 pm #4419471

emelieC

Hi,

I have now updated but that did not seem to help.

Unfortunatelly, our site is live and has visitors pretty much all day long.

I give you permission to create a duplicator file if you remove it and the plugin later.

Kind regards,

Marcus

August 20, 2019 at 8:42 pm #4426473

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Marcus and thanks for trying Noman's suggestions.

Noman is not available today, so I'll continue to handle this ticket. I hope that it is alright with you.

I can see the issue on your site. I can see how the debug.log gets filled very fast with the errors that you added above. Currently, the debug.log is turned off.

I would like to ask you to migrate your site to our test server where I can continue to check this issue. The migration process is quite easy. Please see all the details at the next private reply that I'm going to add now.

Thanks,
Itamar.

August 20, 2019 at 8:43 pm
August 22, 2019 at 12:49 pm #4439487

emelieC

Alright,

It has been done!

August 25, 2019 at 6:26 am #4453305

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi and thanks for migrating your site to our test server.

The problem is not happening on our server. The size of the debug.log is not expanding rapidly. And also there no any related WPML messages.
Can you please connect to your site on our server with SFTP and confirm that you see the issue is happening there?
On your site, I still see that the issue is happening. I'm currently consulting our second tier supporters about this issue. When I have a reply from them, I'll get back to you here.

Please note that the debug.log is now active on your site, but I didn't activate it. I've found it like this when I logged into your site with FTP.

Regards,
Itamar.

August 25, 2019 at 5:37 pm #4454863

emelieC

Hi Itamar,

Thanks for noticing. I have disabled it.

Was it you who changed the following:

/** Memory Limit */
//define('WP_MEMORY_LIMIT', '6144M');
//define( 'WP_MAX_MEMORY_LIMIT', '6144M' );

define('WP_MEMORY_LIMIT', '256M');
define( 'WP_MAX_MEMORY_LIMIT', '256M' );

??

What is the maximum I can put there? I have 8 GB on my server.

Very strange it is not happening in the migration.

Do you mean if I log in with SFTP that the error log would be behaving differently?

It might be that the above messages only occur in some specific cases. And obviously, with all the other stuff going on, we might not be able to see through it.

Will be nice to hear from your devs, and thanks again for the notice.

Kind regards,

Marcus

August 26, 2019 at 4:16 pm #4460293

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Marcus.

It might have been me who changed the WP Memory Limit to:

define('WP_MEMORY_LIMIT', '256M');
define( 'WP_MAX_MEMORY_LIMIT', '256M' );

I'm sorry if I did that and not put it back to what it was. But I must also say that I rarely see such values as you added (6144M). That probably made me suspect that this is not working at all since it exceeds the value that is set on your server. And so only WordPress minimum value of 40M is applied.

You ask: "What is the maximum I can put there?"
I think that 512M is quite enough, and there is no need to exceed that value.
Please check this issue with the support of your hosting service.

You ask: "Do you mean if I log in with SFTP that the error log would be behaving differently?"
Yes. You would currently see that the size of the debug.log is around 84000 byte, and there is no single message that is related to WPML.

Our third-tier supporter wrote that the wp-config.php file should be checked for something that does not suppose to be on it. And also re-save the product addons that are defined – it might be some DB corruption.

I can see the following lines at the top of the file.

define('WP_AUTO_UPDATE_CORE', 'minor');// This setting is required to make sure that WordPress updates can be properly managed in WordPress Toolkit. Remove this line if this WordPress website is not managed by WordPress Toolkit anymore.
/** Enable W3 Total Cache */
define('WP_CACHE', true); // Added by W3 Total Cache

Please be find out whether they need to be there. I say it because I do not see those plugins on your site.

Regards,
Itamar.

September 3, 2019 at 12:06 am #4500181

emelieC

Ok, so in global addons i have to try resave the additions product Choices?

September 3, 2019 at 4:03 pm #4506147

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

Yes, please start by trying this.

Thanks,
Itamar.

September 6, 2019 at 1:31 am #4522243

emelieC

Hello,

i tried to log on with sftp. I have upated all plugins and resaved all product addons. Still get this in error log:

[05-Sep-2019 23:50:51 UTC] PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 151
[05-Sep-2019 23:50:51 UTC] PHP Notice: Undefined index: options in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 151
[05-Sep-2019 23:50:51 UTC] PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 151
[05-Sep-2019 23:50:51 UTC] PHP Notice: Undefined index: options in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 191
[05-Sep-2019 23:50:51 UTC] PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 191
[05-Sep-2019 23:50:51 UTC] PHP Notice: Undefined index: options in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 191
[05-Sep-2019 23:50:51 UTC] PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/ringsofsweden.com/httpdocs/wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php on line 191

Thanks

September 9, 2019 at 12:02 pm #4536883

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

On your site, I've updated WPML and its add-ons to their latest version which was released today. Unfortunately, the issue still persists. I've installed the Duplicator Pro plugin on your site, and I am making a copy of your site to debug the issue further.

I'll keep you updated here.

Thanks,
Itamar.

September 9, 2019 at 2:11 pm #4537895

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

I've made a copy of your site with the Duplicator Pro plugin (already deleted from your site) and escalated this issue to our second tier supporters. They will check things, and we will keep you updated here.

Regards,
Itamar.

September 10, 2019 at 11:08 pm #4549149

emelieC

Thanks!

Looking forward to the reply.

Kind regards,

Marcus