Warning in error log file
-
Hi,
I’m regularly getting this message im my logs:
AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “value” in [mysecretpath]/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Helper/CartProductsHelper.php on line 164’
What is this about and how to fix it?
Thx
Markus
-
Hello @markisu72 ,
The error occurs in the code handling variable products (products with variations). In the file
CartProductsHelper.php, the code attempts to access an array key named “value,” which is not present. It’s not a breaking error, but it can fill your logs.This could happen when product variation was not selected; for example, when a customer adds a variable product to the cart without choosing all required variation attributes. So it’s mostly a question for you whether such a scenario can be reproduced on your site.
And the most crucial question – did this start only after a recent update, or did it already happen before, and across more than one install? That helps us know if this is a regression or a site-specific conflict.
Kind Regards,
KrystianHi Krystian,
I cannot say how long this exists, but at least one week.
Didn’t check the error logs for some time.
What I see in the logs, is:- someone views a product page (with variations)
- /?wc-ajax=get_refreshed_fragments gets called 45 seconds later (possibly due to selecting a variation)
- /?wc-ajax=ppc-simulate-cart gets called three more seconds later
- in that exact moment, the error occurs in the error log
To give to an estimate how often this happens: on 1st of November alone it was about 4.900 times.
I was also able to reproduce this manually and it only happens on variations.
Whenever I select a different variation (basket is empty and I don’t put anything into it), I get that error log entry. Always.
Best
MarkusHello @markisu72
Thanks for the detailed breakdown, and nice that you can reproduce it.
Please switch temporarily to Storefront (or Twenty Twenty-Five) and keep only WooCommerce and PayPal Payments active. Then try to reproduce it once again.
That’s the most crucial test to know whether it’s coming from our side or a third-party hook interacting with the variation data.
Kind regards,
KrystianHi Krystian,
it occurs in relation with Kadence Shop Kit, also with Twenty Twenty-Five.
I checked your code, too. You don’t check if “value” is set.Best
MarkusHello @markisu72
You are right, thanks for confirming.
We have created an internal issue for this and included your thread in it. Once it’s fixed, I will let you know.
Kind Regards,
KrystianHi Krystian,
do you already have a plan for this?
It should be a no-brainer but right now, it completely floods our logs…
MarkusHello @markisu72,
Thanks for checking in, sorry for it taking so long. Yes, we already addressed this on our side. The issue is fixed internally and scheduled for the next plugin release.
This build includes the fix, but please keep in mind it is technically a release candidate. You can download it here: https://drive.google.com/uc?id=1aEnH462-MqhDMSaCJut-n5Zsw_RyPuvI
If you install this version, the log flooding will stop.
Kind Regards,
KrystianThanks a lot Krystian!!!
Do you already have a rough release schedule ?Hi Krystian,
is this fix included in 3.3.1 or will it come in Jan, as you wrote.
Best
Markus
Hello @markisu72 ,
The fix is not included in 3.3.1. This release is only a minor patch focused on the captcha banner.
If anything changes on the schedule, I will let you know.
Kind Regards,
Krystian
You must be logged in to reply to this topic.