Many errors in the log file
-
Hi, I’m using this plugin for a long time without issues, but today my log file is full with over 400 lanes all the same:
‘[14-Jan-2024 07:03:49 UTC] PHP Warning: foreach() argument must be of type array|object, null given in /public_html/wp-content/plugins/google-listings-and-ads/src/MerchantCenter/MerchantStatuses.php on line 472’I’m guessing that is been the moment when sync the products with Google. I have not changed anything on the site more that 2 weeks, except updating your plugin few days ago.
Do you have an idea what is the problem?
Thanks!
- This topic was modified 10 months, 1 week ago by antekapa.
-
Hello there,
Thank you for reaching out and for sharing the error messages with us
To troubleshoot the issue further, could you disable all plugins except WooCommerce and Google Listings, as well as switching to the?Storefront?theme.
If the error no longer appears after doing so, then it is likely that there was a plugin conflict. You can enable the plugins one by one to identify the problematic one. Please be sure to perform these tests on a staging site to avoid damaging any features on your live site.
Additionally, it’s worth considering upgrading your server’s
PHP
version. You can ask your host for assistance with this part. ??Let us know how it goes!
Thanks for your reply.
You should know better than me, that I will not disable anything, thats why I mention that in my previous msg – I have not changed anything for a long time.
I can’t do this on a staging site, because there is not a priducts for syncing with Google, so is not gonna be the same.
About the PHP, I’m using 8.1 for more that 8 months and I don’t think that the problem is there…
Thanks!
Hello again @antekapa.
I understand your concerns about disabling features.
With that said, so that we can have a better understanding of your site setup, could you please share with us your System Status Report, which you can find via WooCommerce > Status > Get system report > Copy for support.
You could copy and paste your reply here or paste it via https://gist.github.com/ and send the link here.Once we have more information, we’ll be able to assist you further.
I hope that will help
- This reply was modified 10 months, 1 week ago by antekapa.
Hi there @antekapa ??
Thank you for reaching back, with further details on this.
If items failed due to errors, those errors will be listed within the logs under?WooCommerce > Status > Logs,?however, there are cases when the logs are just a hint towards the cause of the issue.
Could you please paste the related logs in a pastebin, also, and send us the link?
Furthermore, while investigating the site’s System Status Report (SSR), I noticed a number of failed actions. Feel free to utilize the installed and activated
WP Crontrol
plugin, to gain further insight into what’s happening, as it sounds related with the messages logged (per what is shared in your original message here).The related line of code can be found linked here, for reference.
I hope this helps! Let us know how it goes.
This is the log from google listings:
https://pastebin.com/s1PTB9ZX
is not logs in Fatal errorHi @antekapa,
The logs you’ve shared indicate that it is mapping your product categories correctly and submitting your products to Google in batches.
The
WCProductAdapter::map_product_categories
entries show that the plugin is correctly identifying and mapping your product categories, such as “Electronics > Smart Electronics > Smart Control Panels” and “Fashion > Women’s Fashion > Women’s Tops > Sweaters”.The
ProductSyncer::update_by_batch_requests
entries indicate that the plugin is submitting your products to Google in batches, which is the standard operation for this plugin. The batch requests include the WooCommerce ID and Google ID for each product, which helps keep your Google listings up-to-date with your WooCommerce store.Please note that these are just logs for the plugin operations; there’s no need to worry. However, could you tell us when they first started appearing in the log? Also, have you made any changes, such as enabling WP Debug mode or upgrading or downgrading the PHP version?
Rest assured, the plugin works perfectly, so you do not need to worry about these logs.
Looking forward to hearing from you!
I said that in my first msg, this is happen for a first time today and I never had any issues with the plugin, also I have not changed absolutely anything in the near past, usualy just uploading new products.
If you think that is not an issue, ok, I just want to warn you as a plugin developer to know for a eventual problem.
Thanks!
Hi there @antekapa ??
If you think that is not an issue, ok, I just want to warn you as a plugin developer to know for a eventual problem.
From what I gather, everything appears to be in order.
This is based on posting here a few hours ago, the plugin’s logs, and the store’s System Status Report (SSR) listing the plugin’s latest version (version 2.5.15), which was released a few days ago.
That said, feel free to monitor things for anything out of place, and report back here. I’ll leave the thread open for now.
Cheers!
Ok, thanks I will check the logs often and will see!
Hi @antekapa,
It’s great to see users like you who are proactive in ensuring that everything runs smoothly.
As previously mentioned, the logs you’re seeing are normal operations of the plugin. However, we appreciate your vigilance and your willingness to report any potential issues.
Meanwhile, I’ll mark the thread as solved for now, but please don’t hesitate to create a new topic if you notice anything unusual or have any further questions or concerns. We’re here to help!
Thanks!
I’m having this same line 472 error as well in my error log files. There are different variations but this is basically what they say. Each day has about 100 or so errors
H01071: Got error ‘ PHP Warning: foreach() argument must be of type array|object, null given in /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/google-listings-and-ads/src/MerchantCenter/MerchantStatuses.php on line 472
Yes me too, I still have these at least once per week, but I not seen that to affect anything so I just ignore them…
Hi there @vorticy,
I understand you are also seeing the same errors in your log file. As far as I understand, the logs seem not to affect the functionality of the store.
However, if you are seeing those logs and have an issue with your store, I would suggest you create a new topic?for further assistance.
The error message indicates that there is a PHP Warning in the file
MerchantStatuses.php
at line 472 of the Google Listings and Ads plugin for WordPress. The specific warning is about theforeach()
loop expecting an array or object as its argument, but receivingnull
instead.Here’s what you can do to help the developer troubleshoot and fix the issue:
- Check the Code at Line 472:
Open the fileMerchantStatuses.php
located in/var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/google-listings-and-ads/src/MerchantCenter/
and go to line 472. Look for theforeach()
loop at that line and check how the array or object is being used. It’s likely that there’s an assumption of data being present, which is not the case when the value isnull
. - Handle Null Values:
Modify the code to handle the case where the array or object isnull
. You can add a conditional check before theforeach()
loop to ensure that the variable being iterated is notnull
. For example:if (!is_null($yourArrayOrObject)) { foreach ($yourArrayOrObject as $item) { // your loop logic here } } else { // Handle the case when $yourArrayOrObject is null }
- Error Logging:
It might be helpful to add some error logging to the code to output the value of the variable that is causing the issue. This can provide more information about why it’s becomingnull
. For example:error_log('Value of $yourArrayOrObject: ' . print_r($yourArrayOrObject, true));
- Submit a Bug Report:
Reach out to the plugin developer and provide them with the details of the error, including the file and line number. You can submit a bug report on the plugin’s support forum, GitHub repository, or wherever the developer accepts bug reports. - Temporary Fix:
If you need a quick solution while waiting for the official fix, you can apply the code changes yourself (as described in steps 2 and 3). However, keep in mind that modifying plugin files directly may be overwritten during updates, so it’s best to keep a record of your changes.
It’s not ok to have error logs fill up daily because the plugin can’t handle a null. And to suggest that it is is simply poor.
- This reply was modified 9 months, 3 weeks ago by vorticy.
- The topic ‘Many errors in the log file’ is closed to new replies.